Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <style> div { border: 1px solid black; margin: 5px; } </style> </head> <body> <div id="myDIV"> <p>First p element in div.</p> <p>Another p element in div.</p> <p>A third p element in div.</p> </div> <p>Click the button to find out how many p elements there are inside the div element.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var div = document.getElementById("myDIV"); var nodelist = div.getElementsByTagName("P"); document.getElementById("demo").innerHTML = nodelist.length; } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_nodelist_length_p by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:29:07 GMT --> </html>
Result:
Try it Yourself - © w3schools.com