0 like 0 dislike
27 views
asked in Programming by (5.8k points)

How I can to make expectation of readiness of full page load on pure JS? $(document).ready equivalent without jQuery.
Js document ready. Pure JavaScript equivalent of jQuery document ready.

Your answer

Try to answer the question as detailed as possible.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

0 like 0 dislike
answered by (5.8k points)

Use addEventListener and event DOMContentLoaded.

Common template:

document.addEventListener("DOMContentLoaded", callback);

Examples:

document.addEventListener('DOMContentLoaded', function() {
// ...
});

or

document.addEventListener("DOMContentLoaded", function(event) { 
  // ...
});

Links

Related questions

0 like 0 dislike
1 answer 25 views
0 like 0 dislike
1 answer 16 views
0 like 0 dislike
1 answer 19 views
0 like 0 dislike
1 answer 12 views
0 like 0 dislike
1 answer 29 views
0 like 0 dislike
1 answer 18 views
0 like 0 dislike
1 answer 22 views
0 like 0 dislike
1 answer 21 views
...