Why is $ undefined when I try to use jQuery in GreaseMonkey?

Posted by Natrium on Stack Overflow See other posts from Stack Overflow or by Natrium
Published on 2010-03-24T13:02:03Z Indexed on 2010/03/24 13:03 UTC
Read the original article Hit count: 189

Filed under:
|

I'm totally new to GreaseMonkey, but I'm trying to make a little script.

// ==UserScript==
// @require       http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// ==/UserScript==
(function() {
    $ = unsafeWindow.jQuery;
    alert($); // this gives 'undefined'
}());

Why does the alert give undefined and how to fix this?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about greasemonkey