Reset nameProperty
Reset Object
Definition and Usage
The name property sets or returns the value of the name attribute of the reset button.
The name attribute is used to transmit data to the server after form submission, or to reference form data in JavaScript.
Note:After form submission, only the name attribute of form elements will transmit the data value.
Syntax
Set the name property:
resetObject.name="name"
Return the name property:
resetObject.name
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the name property
Example
Example
The following example returns the name of the reset button:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rookie Tutorial (example.com)</title>
<script>
function displayResult(){
var x=document.getElementById("reset1").name;
alert(x);
}
</script>
</head>
<body>
<form>
Email: <input type="text" id="email">
<input type="reset" name="reset1" id="reset1">
</form>
<button type="button" onclick="displayResult()">Display the name of the reset button</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Rookie Tutorial (example.com)</title>
<script>
function displayResult(){
var x=document.getElementById("reset1").name;
alert(x);
}
</script>
</head>
<body>
<form>
Email: <input type="text" id="email">
<input type="reset" name="reset1" id="reset1">
</form>
<button type="button" onclick="displayResult()">Display the name of the reset button</button>
</body>
</html>
Try it Yourself »
Reset Object Other Extensions