YouTip LogoYouTip

Prop Search Name

HTML DOM Input Search name Property |

-- Learning is not just about technology, but also about dreams!

JavaScript Reference Manual

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

HTML DOM Reset Object

HTML DOM Submit Object

Input Search name Property

Input Search Object Reference Manual Input Search Object

Example

Get the name of the search field:

var x = document.getElementById("mySearch").name;

x output result is:

googlesearch

Try it yourself Β»


Definition and Usage

The name property is used to set or return the value of the name attribute of a search field.

The name property is typically used as an identifier for submitting form data to the server, or as a reference identifier for JavaScript on the client side.

Note: Data can only be submitted to the server after a form is submitted if the name attribute is set.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the name property.


Syntax

Return the name property:

searchObject.name

Set the name property:

searchObject.name=name

Property Values

Value Description
name Specifies the name of the search field

Technical Details

Return Value: A string representing the name of the search field

More Examples

Example

Change the name of the search field:

document.getElementById("mySearch").name = "newSearchName";

Try it yourself Β»


Related Pages

HTML Reference: HTML <input> name Attribute


Input Search Object Reference Manual Input Search Object

← Prop Search RequiredProp Search Readonly β†’