I want to select the element that called the jQuery function. I think this should be working, but it’s not.
The element:
<a href="#" onclick="$.myFunction(this)">link</a>
The function:
(function ($) {
$.myFunction = function (element) {
element.hide()
}
}(jQuery));
thisis the DOM node, so try withAs a sidenote avoid if possible to use inline handlers since they will make your code soon or later messy and unmantainable: if you are in control of the code you could write instead
and
using a cleaner event delegation