YouTip LogoYouTip

Prop Search Readonly

# Input Search readOnly Property [![Image 8: Input Search Object Reference Manual](#) Input Search Object](#) ## Example Set the search field to read-only: ```javascript document.getElementById("mySearch").readOnly = true; Output: [Try it Β»](#) * * * ## Definition and Usage The readOnly property is used to set or return whether a search field is read-only. A read-only field cannot be modified. However, the content of the field can be copied. This property reflects the HTML readonly attribute. **Tip:** To ensure the accuracy of form data, you can use the (#) property instead. * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) The readOnly property is supported by all major browsers. * * * ## Syntax Return the readOnly property: _searchObject_.readOnly Set the readOnly property: _searchObject_.readOnly=true|false ## Property Values | Value | Description | | --- | --- | | true|false | Specifies whether the search field is read-only * true - The search field is read-only * false - Default. The search field is not read-only | ## Technical Details | Return Value: | A Boolean value. Returns true if the search field is read-only, otherwise returns false. | | --- | * * * ## More Examples ## Example Check if the search field is read-only: ```javascript var x = document.getElementById("mySearch").readOnly; The output of _x_ will be: true [Try it Β»](#) * * * ## Related Pages HTML Reference: (#) * * Input Search Object](#)
← Prop Search NameProp Search Maxlength β†’