Input Search name Attribute
Definition and Usage
name
Sets or returns the value of the name attribute of the search field.
The HTML name attribute is used to identify form data after the form data is submitted to the server, or to reference form data on the client using JavaScript.
Note:Only form elements with the name attribute will pass their values when submitting the form.
See also:
HTML Reference Manual:HTML <input> name Attribute
Example
Example 1
Get the name of the search field:
var x = document.getElementById("mySearch").name;
Example 2
Change the name of the search field:
document.getElementById("mySearch").name = "newSearchName";
Syntax
Return name attribute:
searchObject.name
Set name attribute:
searchObject.name = name
Attribute Value
Value | Description |
---|---|
name | Specifies the name of the search field. |
Technical Details
Return Value: | A string value representing the name of the search field. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |