HTML DOM Checkbox name attribute
Definition and Usage
name property sets or returns the element name attribute value checkbox.
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:
checkboxObject.name="name"
Returns the name attribute:
checkboxObject.name
Browser Support
All major browsers support attribute name
Examples
Examples
The following example output checkbox name:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
var x = document.getElementById ( "myCheck") name.;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form>
<Input type = "checkbox" name = "check1" id = "myCheck"> do you like summer?
</ Form>
<Button type = "button" onclick = "displayResult ()"> Display Name </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
var x = document.getElementById ( "myCheck") name.;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form>
<Input type = "checkbox" name = "check1" id = "myCheck"> do you like summer?
</ Form>
<Button type = "button" onclick = "displayResult ()"> Display Name </ button>
</ Body>
</ Html>
try it"
Checkbox objects