原文: https://stackoverflow.com/questions/7341865/checking-if-jquery-is-loaded-using-javascript

Well, you are using jQuery to check for the presence of jQuery. If jQuery isn’t loaded then $() won’t even run at all and your callback won’t execute, unless you’re using another library and that library happens to share the same $() syntax.

Remove your $(document).ready() (use something like window.onload instead):

window.onload = function() {
    if (window.jQuery) {  
        // jQuery is loaded  
        alert("Yeah!");
    } else {
        // jQuery is not loaded
        alert("Doesn't Work");
    }
}

Like this post? Share on:


doobom Avatar doobom is write a bug.
Comments

So what do you think? Did I miss something? Is any part unclear? Leave your comments below.

comments powered by Disqus

Keep Reading


Published

Category

Javascript

Tags

Stay in Touch

Get New Release Alert