JavaScript and Dynamic Data
Last updated
Last updated
The Template editor provides an HTML and a CSS tab but no JavaScript one. You can still use JavaScript though!
To use JS in your Templates, you can open a script
tag and start working.
To make using JavaScript in your Template more powerful, you can access your Document payload as a JavaScript object.
Start by enabling JavaScript injection for your Template in its Settings tab:
Let's say you defined your payload as follows:
You can now access the payload data this way: