# escapejs

Source: https://zotonic.com/docs/1836/escapejs

URI: https://zotonic.com/id/1836

Language: en



Escapes the value for insertion in JavaScript output.

For example:

```django
{{ 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 <a href="/id/doc_template_filter_filter_escapejson" class="doc-reference doc-reference-filter"><code>filter#escapejson</code></a>, as JSON escaping is subtly different from JS escaping.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1836?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1836?language=en>)
