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

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

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

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.


Number of scripts are :3

Comments or Responses

Login to post response