Elements Reference
JavaScript Code
The JavaScript Code element runs a script on the page. Write plain JavaScript — no
<script> tags — and Oxygen outputs it at the end of the page, wrapped in a
DOMContentLoaded listener so the document is ready by the time your code runs.
Content

- JavaScript Code — the code editor, with syntax highlighting.
- Disable Builder Label / Builder Label — in the builder the element appears
only as a striped label block; rename it via Builder Label or hide it with
Disable Builder Label.
Where and when the code runs
Two things to know:
- The script runs on the real page only — never inside the builder. The canvas
shows the label block, but your code doesn't execute there, so test on the front
end. - It runs after
DOMContentLoaded. Your code can safely query elements anywhere on
the page without its own ready-check.
On the front end
The element adds no markup where it sits — no wrapper div, nothing. Its only output
is an inline <script> before </body> containing your code inside the
DOMContentLoaded listener.