1$(document).ready(function(){
2 if (jQuery) {
3 // jQuery is loaded
4 alert("Yeah!");
5 } else {
6 // jQuery is not loaded
7 alert("Doesn't Work");
8 }
9});
1jQuery offers several ways to attach a function that will run when the DOM is ready. All of the following syntaxes are equivalent:
2
3$( handler )
4$( document ).ready( handler )
5$( "document" ).ready( handler )
6$( "img" ).ready( handler )
7$().ready( handler )