jquery check when element is loaded code example
Example 1: check if jquery is loaded
$(document).ready(function(){
if (jQuery) {
// jQuery is loaded
alert("Yeah!");
} else {
// jQuery is not loaded
alert("Doesn't Work");
}
});
Example 2: call a function on load jquery
$(document).ready(function () {
// Function code here.
});
Example 3: jquery onload event
// A $( document ).ready() block.
$( document ).ready(function() {
console.log( "ready!" );
});
Example 4: javascript if has jquery loaded
window.onload = function() {
if (window.jQuery) {
// jQuery is loaded
alert("Yeah!");
} else {
// jQuery is not loaded
alert("Doesn't Work");
}
}