Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <script> function getElements() { var x = document.getElementsByName("x"); document.getElementById("demo").innerHTML = x.length; } </script> </head> <body> <p> Cats: <input name="x" type="radio" value="Cats"> Dogs: <input name="x" type="radio" value="Dogs"> </p> <p> <input type="button" onclick="getElements()" value="How many elements named x?"> </p> <p id="demo"></p> </body> <!-- Mirrored from www.w3schools.com/js/tryit.asp?filename=tryjs_doc_getelementsbyname by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 07:24:39 GMT --> </html>
Result:
Try it Yourself - © w3schools.com