Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <form id="frm1" action="http://www.w3schools.com/js/form_action.asp"> First name: <input type="text" name="fname" value="Donald"><br> Last name: <input type="text" name="lname" value="Duck"><br><br> <input type="submit" value="Submit"> </form> <p>Click "Try it" to display the number of elements the form:</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("frm1").length; document.getElementById("demo").innerHTML = x; } </script> </body> <!-- Mirrored from www.w3schools.com/js/tryit.asp?filename=tryjs_form_length by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 07:36:52 GMT --> </html>
Result:
Try it Yourself - © w3schools.com