Search.../

html

Sets or gets the contents of a text element using standard HTML.

Description

Setting the html property sets the text and styling of the text element. You can use a subset of HTML tags and CSS attributes as described above. Any text that the element already contained is replaced.

Getting the html property returns the element's text, including HTML tags.

The html property maps the Editor's built-in text themes and custom formatting to HTML and CSS as described here.

To set or get the plain, unstyled contents of a text element, use the text property instead.

Type:

stringRead & Write

Related Content:

Was this helpful?

Get a text element's HTML content

Code Example

Copy Code
1let value = $w("#textElement").html // "<b>Bold Text</b>"
Set a text element's HTML content

Code Example

Copy Code
1$w("#textElement").html = "<b>Bold Text</b>";