CodeAPI

ReadOnlyMixin

Provides functionality for input elements which support readonly mode.

Table of Contents

PROPERTIES

?
Store values associated with an object.
readOnlySets or gets if a user can modify the value of the input element.

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:

Syntax

get readOnly(): boolean
TYPE
?
The kind of data the property stores.
boolean

Examples

Get whether the element is readOnly

let isReadonly = $w("#myElement").readOnly; // true

Set an element to be readOnly

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