JSUtil - escapeText(String text)

Escapes invalid XML characters such as "< > &".

Table 1. Parameters
Name Type Description
text String The text
Table 2. Returns
Type Description
String The text with escape characters added.

var html = "<b>This is my title</b>";
 
gs.print(JSUtil.escapeText(html));
Output: This is the value returned. If the result is displayed in the application, the page renders the brackets back so it appears that it is not escaped.
<b>This is my title</b>