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>
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>