Easy Tutorial
❮ Dom Obj Tablehead Prop Screen Pixeldepth ❯

Input Search readOnly Property

Input Search Object

Example

Set the search field to read-only:

document.getElementById("mySearch").readOnly = true;

Output result:


Definition and Usage

The readOnly property is used to set or return whether the search field is read-only.

Read-only fields cannot be modified. However, their content can be copied.

This property reflects the HTML readonly attribute.

Tip: To ensure the accuracy of form data, you can use the disabled property as an alternative.


Browser Support

All major browsers support the readOnly property.


Syntax

Return the readOnly property:

Set the readOnly property:

Property Values

Value Description
true false Describes whether the search field is read-only<br> true - The search field is read-only<br> false - Default. The search field is not read-only

Technical Details

| Return Value: | Boolean, returns true if the search field is read-only, otherwise returns false. | | --- | --- |


More Examples

Example

Check if the search field is read-only:

var x = document.getElementById("mySearch").readOnly;
true

Related Pages

HTML Reference: HTML <input> readonly Attribute


❮ Dom Obj Tablehead Prop Screen Pixeldepth ❯