I'm trying (and for the most part succeeding) to use the tipsy jQuery plugin in my greasemonkey script. I am using the @require meta tag to import the jquery and tipsy js, and it works, but with a couple caveats which I'm trying to overcome.
Accessing elements as a pure jQuery object fails, so I'm relegated to using DOM functions to get my elements:
//this fails
$('#login').find('a:first').tipsy();
//while this succeeds
$(document.getElementById('login').getElementsByTagName('a')[0]).tipsy();
Anyone know why? Need more info? TIA!
I think it's because inside Greasemonkey, jQuery has a different default context than the document. Try this:
$("#login", document).find('a:first').tipsy();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.