The form
property gets the form that contains the reset button.
form |
Yes | Yes | Yes | Yes | Yes |
var v = resetObject.form
A reference to the form element containing the reset button. If the reset button is not in a form, null is returned.
The following code shows how to get the id of the form containing the <input type="reset"> element.
<!DOCTYPE html>
<html>
<body>
<!--from w ww .ja v a 2 s . c o m-->
<form id="myForm">
<input type="reset" id="myReset">
</form>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myReset").form.id;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: