JavaScript global method: stripHtml

Takes HTML content and strips out the HTML tags and returns the content as text without the HTML tags.

Syntax

stripHtml(htmlstr);

Arguments

The following arguments are valid for this function:

Argument Data type Required Description
htmlstr String Yes This argument contains the JavaScript String with HTML tags that you want to strip out of the string.

Returns

JavaScript String without HTML tags.

Throws

None

Description

Takes HTML content and strips out the HTML tags and returns the content as text without HTML tags.

Example

var htmlstr = "<html><body>Hello</body></html>";
var text = stripHtml(htmlstr);
print("before stripping HTML tags: " + htmlstr);
print("after stripping HTML tags: " + text);