<form name="myForm" action="https://www.PuStudy.Com/resources/html-forms-action.html"> <input type="search" name="mySearchField"> <button>Search</button> </form>
The above example demonstrates usage of the
<input> element with the
type attribute set to
search value represents text with no line breaks. The field becomes a one line plain text input control.
Technically, there's not much difference between using
text. Although, it's probably quite apparent when you would use one over the other. The
search value is intended to be used for a search input field on a search form. The
text value serves a more general purpose.
Here's what the HTML5 specification says about this:
The difference between the Text state and the Search state is primarily stylistic: on platforms where search fields are distinguished from regular text fields, the Search state might result in an appearance consistent with the platform's search fields rather than appearing like a regular text field.