YouTip LogoYouTip

Prop Search Required

# Input Search required property [![Image 8: Input Search Object Reference Manual](#) Input Search Object](#) ## Example Check if the search field is required before submitting the form: var x = document.getElementById("mySearch").required; The output of _x_ is: true [Try it Β»](#) * * * ## Definition and Usage The required property is used to set or return whether the search field is a required field in a form. This property reflects the HTML required attribute. * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) The required property is supported by all major browsers, except Internet Explorer 9 and earlier IE versions, and Safari. * * * ## Syntax To return the required property: _searchObject_.required To set the required property: _searchObject_.required=true|false ## Property Values | Value | Description | | --- | --- | | true|false | Specifies whether the search field is a required part of the form before submission. * true - The search field is a required part of the form. * false - Default. The search field is an optional part of the form. | ## Technical Details | Return Value: | A Boolean. Returns true if the search field is a required part of the form, otherwise returns false. | | --- | * * * ## More Examples ## Example Set the search field as a required part of the form: document.getElementById("mySearch").required = true; [Try it Β»](#) * * * ## Related Pages HTML Reference: (#) * * Input Search Object](#)
← Prop Search ValueProp Search Readonly β†’