Using jQuery plugins in greasemonkey (i.e. tipsy)

I am trying (and mostly succeeding) to use a tipsy jQuery plugin in my greasemonkey script. I use the @require meta tag to import jQuery and tipsy js, and it works, but with a few caveats that I'm trying to overcome.

Access to elements as a pure jQuery object fails, so I am disconnecting from using DOM functions to get my elements:

//this fails
$('#login').find('a:first').tipsy(); 

//while this succeeds
$(document.getElementById('login').getElementsByTagName('a')[0]).tipsy();

Does anyone know why? Do you need more information? TIA!

+3
source share
1 answer

, , Greasemonkey jQuery , . :

$("#login", document).find('a:first').tipsy();
+5

Source: https://habr.com/ru/post/1778765/


All Articles