Skip to content

ProtoString cleanHTML() Method

Seth Clydesdale edited this page Jun 9, 2015 · 1 revision

<< Back to DOM Node Methods

Examples

Clean the HTML tags and entities from a text string.

'<p>Coffee &amp; Cookies</p>'.cleanHTML(); // returns 'Coffee Cookies'

Passing true as the parameter will ignore entities.

'<p>Coffee &amp; Cookies</p>'.cleanHTML(true); // returns 'Coffee &amp; Cookies'

Description

The cleanHTML method can be used to clean a text string of HTML tags and entities. You can choose whether or not you want to remove entities by passing a boolean value as the parameter.

Syntax

String.cleanHTML(ignore);

Parameters

Parameter Description
ignore Takes a boolean value which specifies if HTML entities should be ignored. Passing true as the parameter will keep HTML entities. Defaults to removing entities and tags.
Clone this wiki locally