Easy Tutorial
❮ Jsref Small Prop Style Liststyleimage ❯

Reset name Attribute


Definition and Usage

The name attribute sets or returns the value of the name attribute of a reset button.

The name attribute is used to send data to the server after form submission or to reference form data in JavaScript.

Note: Only the name attribute of form elements is transmitted with the data value after form submission.

Syntax

Set the name attribute:

Return the name attribute:


Browser Support

All major browsers support the name attribute.


Example

The following example returns the name of the reset button:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</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>

❮ Jsref Small Prop Style Liststyleimage ❯