Reset formProperty
Reset Object
Definition and Usage
The form property returns a reference to the form that contains the reset button.
If successful, this property returns a form object.
Syntax
resetObject.form
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the form property.
Example
Example
Display the id of the form that contains the reset button:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<script>
function displayResult(){
var x=document.getElementById("reset1").form.id;
alert(x);
}
</script>
</head>
<body>
<form id="form1">
Email: <input type="text" id="email">
<input type="reset" id="reset1">
</form>
<button type="button" onclick="displayResult()">Display the form ID it belongs to</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<script>
function displayResult(){
var x=document.getElementById("reset1").form.id;
alert(x);
}
</script>
</head>
<body>
<form id="form1">
Email: <input type="text" id="email">
<input type="reset" id="reset1">
</form>
<button type="button" onclick="displayResult()">Display the form ID it belongs to</button>
</body>
</html>
Try it Yourself »
Reset Object Other Extensions