DOMContentLoaded
Utility
JS
- DOMContentLoaded runs after the HTML is loaded and parsed so it is safe to target elements with JavaScript.
<script>
document.addEventListener("DOMContentLoaded", function () {
// run code here
});
</script>Preview Links
Custom JS
Enable custom code in preview or view on published site.
Enable custom code?
Last Updated: Dec 4, 2025
- DOMContentLoaded runs after the HTML is loaded and parsed so it is safe to target elements with JavaScript.
<script>
document.addEventListener("DOMContentLoaded", function () {
// run code here
});
</script>