YouTip LogoYouTip

Prop Search Maxlength

# Input Search maxLength Property [![Image 8: Input Search Object Reference](#) Input Search Object](#) ## Example Get the maximum number of characters allowed in the search field: var x = document.getElementById("mySearch").maxLength; The _x_ output will be: 30 [Try it Β»](#) * * * ## Definition and Usage The maxLength property sets or returns the value of the maxlength attribute of a search field. The maxLength property describes the maximum number of characters allowed in the search field. The default value is 524288. **Tip:** To set or return the length (in characters) of the search field, use the (#) property. * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) The maxLength property is supported in all major browsers. * * * ## Syntax Return the maxLength property: _searchObject_.maxLength Set the maxLength property: _searchObject_.maxLength=_number_ ## Property Values | Value | Description | | --- | --- | | _number_ | Describes the maximum number of characters allowed in the search field. Default is 524288 | ## Technical Details | Return Value: | A number representing the maximum number of characters allowed in the search field. | | --- | * * * ## More Examples ## Example Change the maximum number of characters allowed in the search field: document.getElementById("mySearch").maxLength = "8"; [Try it Β»](#) * * * ## Related Pages HTML Reference: (#) * * Input Search Object](#)
← Prop Search NameProp Search Form β†’