documento jQuery pronto
// jQuery document ready
$(document).ready(function() {
});
Ugly Unicorn
// jQuery document ready
$(document).ready(function() {
});
document.addEventListener("DOMContentLoaded", function() {
// code
});
// A document ready block with JQery.
$( document ).ready(function() {
// we ready for fire action with JQery.
});
// A document ready block with javascript.
document.addEventListener("DOMContentLoaded", function(event) {
// we ready for fire action with javascript.
});
// Pure JS document ready ...
document.addEventListener('DOMContentLoaded', (event) => {
//the event occurred
})
Two syntaxes can be used for this:
$( document ).ready(function() {
console.log( "ready!" );
});
Or the shorthand version:
$(function() {
console.log( "ready!" );
});
// A $( document ).ready() block.
$( document ).ready(function() {
console.log( "ready!" );
});