javascript DOM loaded

document.addEventListener('DOMContentLoaded', function(){
	// code to run when DOM is loaded
});

This feature is supported by modern browsers (IE9+).

Same as "$(document).ready(function(){})" but without using jQuery.

Leave a Comment