

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get the number of forms in a document with JavaScript?
To get the number of forms in a document, use the form property with length property in JavaScript.
Example
You can try to run the following code to get the number of forms in a document −
<!DOCTYPE html> <html> <body> <form> Name: <input type="text" name="my_name" value="Amit"> Subject: <input type="text" name="my_subject" value="Java"> <input type="submit" value="Submit"> </form> <script> var val = document.forms.length; document.write("<br>Number of forms in the document: "+val); </script> </body> </html>
- Related Questions & Answers
- How to return the number of images in a document with JavaScript?
- How to show the number of links in a document with JavaScript?
- How to get the cookies associated with a document in JavaScript?
- How to find the number of links in a document in JavaScript?
- How to display the title of a document with JavaScript?
- How to get the title and full URL of a document in JavaScript?
- How to use JavaScript to replace the content of a document with JavaScript?
- How to get a decimal portion of a number with JavaScript?
- How to find a number of anchors in a document in JavaScript?
- How to show the full URL of a document with JavaScript?
- How to get the cosine of a number in JavaScript?
- How to get the sine of a number in JavaScript?
- How to get the tangent of a number in JavaScript?
- How to get the length of a Number in JavaScript?
- Checking whether the sum of digits of a number forms a Palindrome Number or not in JavaScript
Advertisements