Latest web development tutorials

HTML DOM Input Search readOnly property

Input Search Object Reference Input Search Object

Examples

Set the search field to read-only:

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

Output:


try it"

Definition and Usage

readOnly property sets or returns the search field is read-only.

Read-only fields can not be modified. But you can copy the contents of the field.

This property reflects the HTML readonly attribute.

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support readOnly property.


grammar

Back readOnly attributes:

searchObject .readOnly

Set readOnly properties:

searchObject .readOnly = true | false

Property Value

value description
true | false Describes the search field is read-only
  • true - the search field is read-only
  • false - default. Search field is not read-only

technical details

return value: Boolean value that, if the search field is read-only returns true, otherwise returns false.


More examples

Examples

View search field is read-only:

var x = document.getElementById ( "mySearch") readOnly.;
x The output is:
true

try it"


Related Pages

HTML Reference Manual: HTML <the INPUT> Readonly property


Input Search Object Reference Input Search Object