JavaScript and Dynamic Data

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.

HTML
<script>
  // Write some JavaScript in here.
</script>

Accessing the Document payload

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:

Debugging your JavaScript

Last updated

Was this helpful?