Open In App

HTML DOM Input Search name Property

Last Updated : 02 Jan, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The Input Search name Property in HTML DOM is used to set or return the value of the name attribute of a search field. The name attribute is required for each input field. If the name attribute is not specified in an input field then the data of that field would not be sent at all. 

Syntax: 

  • It returns the Input search name property.
searchObject.name
  • It is used to set the Input search name property.
searchObject.name = name

Property Values: It contains a single value name which defines the name of the search field. 

Return Value: It returns a string value which represents the name of the search field. 

Example 1: This example returns the Input search name property. 

Output: 

search-name

Example 2: This example illustrates how to set the Input Search name Property. 

Output: 

search-name-2

Supported Browsers:

  • Google Chrome 5 and above
  • Edge 12 and above
  • Firefox 4 and above
  • Opera 10.6 and above
  • Safari 5 and above

Next Article
Practice Tags :

Similar Reads