Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>The Document Object</h1>
<h2>The forms Property</h2>
<form>
<p>First Name: <input type="text" name="fname" value="Donald"></p>
<p>Last Name: <input type="text" name="lname" value="Duck"></p>
</form>
<p>The number of form elements in the document is:</p>
<p id="demo"></p>
<script>
let num = document.forms.length;
document.getElementById("demo").innerHTML = num;
</script>
</body>
</html>