Search.../

readOnly

Sets or gets if a user can modify the value of the input element.

Description

Setting the value of the readOnly property to true prevents users from changing the element's value. However, it does not limit your ability to change the value programmatically. Setting it to false allows users to change the element's value.

Getting the value of the readOnly property returns whether a user can modify the value of the input element.

You can also set an element's readOnly property in the Editor using the Settings pane:

Input Settings pane

Type:

booleanRead & Write
Mixed in from:$w.ReadOnlyMixin

Was this helpful?

Get whether the element is readOnly

Copy Code
1let isReadonly = $w("#myElement").readOnly; // true
Set an element to be readOnly

Copy Code
1$w("#myElement").readOnly = true;