- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM Input Number form Property
The HTML DOM input number form property returns the reference of the form that contains the number input field in the HTML document.
Syntax
Following is the syntax −
object.form
Example
Let us see an example of HTML DOM input number form property −
<!DOCTYPE html> <html> <head> <style> body{ text-align:center; background-color:#1b203a; color:#fff; } form{ margin:2.5rem auto; border:1px solid #fff; padding:2rem; } button{ background-color:#db133a; border:none; cursor:pointer; padding:8px 16px; color:#fff; border-radius:5px; font-size:1.05rem; outline:none; } input{ border:none; background-color:#ffffff4a; height:1.2rem; padding:8px; color:#fff; font-weight:bold; font-size:1rem; } .show{ font-weight:bold; font-size:1.4rem; } </style> </head> <body> <h1>form Property Demo</h1> <form id="Form 1"> <legend>Form 1</legend> <input type="number" class="numberInput" value="12345300"> </form> <button onclick="identify()">Identify Number Input Field</button> <p class="show"></p> <script> function identify() { var formId = document.querySelector(".numberInput").form.id; document.querySelector(".show").innerHTML = "Hi! I'm from " + formId; } </script> </body> </html>
Output
This will produce the following output −
Click on “Identify Number Input Field” button to identify the form which contain the input number field.
- Related Articles
- HTML DOM Input Button form Property
- HTML DOM Input FileUpload form Property
- HTML DOM Input Hidden form Property
- HTML DOM Input Month form Property
- HTML DOM Input Radio form Property
- HTML DOM Input Range form property
- HTML DOM Input Reset form property
- HTML DOM Input Checkbox form Property
- HTML DOM Input Color form Property
- HTML DOM Input Date form Property
- HTML DOM Input Datetime form Property
- HTML DOM Input DatetimeLocal form Property
- HTML DOM Input Email form Property
- HTML DOM Input Time form Property
- HTML DOM Input URL form Property

Advertisements