escapejsΒΆ

Escapes the value for insertion in Javascript output.

For example:

{{ value|escapejs }}

When the value is he'llo then the output is he\x27llo.

Internally, this calls z_utils:js_escape/1 to perform the escaping.

Note: when generating JSON output, be sure to use escapejson, as JSON escaping is subtly different from JS escaping.

See also

escape, escapejson

Previous topic

escape_link

Next topic

escapejson

Versions

Actions