HTML DOM Submit name attribute
Definition and Usage
name property sets or returns the name attribute value of the submit button.
name attribute is used after the form is submitted to the server to transmit data or form data referenced in Javascript.
Note: After the form is submitted only name attribute of the form element will pass data values.
grammar
Setting name attribute:
submitObject.name="name"
Returns the name attribute:
submitObject.name
Browser Support
All major browsers support attribute name
Examples
Examples
The following example shows the name of the button to confirm:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
var x = document.getElementById ( "submit1") name.;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form>
Email: <input type = "text" id = "email">
<Input type = "submit" name = "submit1" id = "submit1">
</ Form>
<Button type = "button" onclick = "displayResult ()"> Display name of the submit button </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
var x = document.getElementById ( "submit1") name.;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form>
Email: <input type = "text" id = "email">
<Input type = "submit" name = "submit1" id = "submit1">
</ Form>
<Button type = "button" onclick = "displayResult ()"> Display name of the submit button </ button>
</ Body>
</ Html>
try it"
Submit objects