Search.../

text

Sets or gets the plain-text contents of a text element.

Description

Setting the text property sets the plain-text contents of the text element. Any text that the element already contained is replaced. The new text is formatted using the formatting that was used on of the first character of the previous text value.

Getting the text property returns the plain-text content of the element, without any HTML tags.

To set or get the HTML contents of a text element, use the html property instead.

Type:

stringRead & Write, default value is An empty string

Related Content:

Was this helpful?

Get a text element's plain-text content

Code Example

Copy Code
1let value = $w("#textElement").text // "Text Value"
Set a text element's plain-text content

Code Example

Copy Code
1$w("#textElement").text = "Text Value";