
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML DOM Input Reset form property
The HTML DOM Input Reset form property is used for returning the form reference that contains the given reset button. If the reset button is outside the form then it will simply return NULL. This property is read-only.
Syntax
Following is the syntax for input Reset form property.
resetObject.form
Example
Let us look at an example for the Input Reset form property −
<!DOCTYPE html> <html> <body> <h1>Input reset form Property</h1> <form id="FORM_1" style="border:solid 2px green;padding:2px"> UserName: <input type="text" id="USR"> <br> Location: <input type="text" id="Age"> <br><br> <input type="reset" id="RESET1"> </form> <p>Get the form id by clicking on the below button</p> <button type="button" onclick="formId()">GET FORM</button> <p id="Sample"></p> <script> function formId() { var P=document.getElementById("RESET1").form.id; document.getElementById("Sample").innerHTML = "The id of the form containing the reset button is: "+P ; } </script> </body> </html>
This will produce the following output −
On clicking the GET FORM button −
In the above example −
We have created an <input> element with type=”reset”, id=”RESET1”. Clicking on this button will reset the form data. This button is inside a form that contains two text fields and the form also has an inline style applied to it.
<form style="border:solid 2px green;padding:2px"> UserName: <input type="text" id="USR"> <br> Location: <input type="text" id="Age"> <br><br> <input type="reset" id="RESET1"> </form>
We then created a button GET FORM that will execute the formId() method on being clicked by the user.
<button type="button" onclick="formId()">GET FORM</button>
The formId() method uses the getElementById() method to get the input field with type reset and gets the id property of the form object that contains the reset button. It then assigns this value to variable P and displays in the paragraph with id “Sample” using its innerHTML property −
function formId() { var P=document.getElementById("RESET1").form.id; document.getElementById("Sample").innerHTML = "The id of the form containing the reset button is: "+P ; }
- Related Articles
- HTML DOM Input Reset autofocus property
- HTML DOM Input Reset disabled property
- HTML DOM Input Reset name property
- HTML DOM Input Reset type property
- HTML DOM Input Reset value property
- 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 Number form Property
- HTML DOM Input Radio form Property
- HTML DOM Input Range form property
- HTML DOM Input Checkbox form Property
- HTML DOM Input Color form Property
- HTML DOM Input Date form Property
