How to find out how many script tags are present in HTML page

Manideepgoud
Posted by Manideepgoud under JavaScript category on | Points: 40 | Views : 867
To find out how many script tags present in the HTML page we use document.scripts.length

   <p id="demo"></p>
<script></script>
<script></script>
<script>
document.getElementById('demo').innerHTML = "Number of scripts in the page are :" + document.scripts.length;
</script>

In the above code we have given three <script> tags , document.scripts.length finds out how many <script> we are using in the HTML page.

OUTPUT

Number of scripts are :3

Comments or Responses

Login to post response