Finding Forms in HTML Page using javascript

Posted by Manideepgoud under JavaScript category on | Points: 40 | Views : 279
We can find how many form element we are using in a HTML page using document.forms.length by using JavaScript DOM ELEMENTS.
FirstName: <input type="text" />
</form><br />
LastName:<input type="password" />
<p id="demo"></p>
document.getElementById('demo').innerHTML = "Number of Forms in the page :" + document.forms.length;

Here we have taken two forms in the page , so it displays 2 in the output

Number of forms in the page:2

Comments or Responses

Login to post response