-
Notifications
You must be signed in to change notification settings - Fork 0
rife.render.EncodeJs
Erik C. Thauvin edited this page Mar 26, 2023
·
2 revisions
Encodes a template value to JavaScript/ECMAScript.
<!--v render:rife.render.EncodeJs:valueId/-->
{{v render:rife.render.EncodeJs:valueId/}}
Template
alert("{{v render:rife.reader.EncodeJs:alert/}}");
Code
template.setAttribute("alert", "It's alright! Everything is /OK/!");
Output
alert("It\'s alright! Everything is \/OK\/!");
By default, the rendered data is raw, not template encoded. If you need additional encoding, use the encoding
property.
For example, to encode the rendered data to HTML:
{{v render:rife.render.EncodeJs:valueId}}
encoding=html
{{/v}}
The supported additional encoding types are:
html
js
json
unicode
url
xml