I’m working in a mixed environment of prototype/scriptaculous and jQuery. Not my implementation, but now it’s my problem: I’m working to remove prototype/scriptaculous everywhere and replace both with vanillaJS as time permits.
In the meantime, let us say I have a DOM element, jQuery’d like this:
$(“#myElement”)
Is it possible to get the jQuery object from this so I don’t have to pass ‘$’ from function to function as an extra parameter? e.g.:
function foo($) {
const myElement = $("#myElement");
...do some stuff to myElement here...
bar(myElement);
}
function bar(myElementIn) {
const $ = {somehow get the jQuery object from myElementIn};
...do more stuff with other elements related to myElementIn...
}
Longshot, I’m sure, but figured it was worth asking.