Let's say I have a jQuery function like this:
$.fn.foo = function(param, callback) {
if (typeof callback === 'function') {
callback(params);
}
}
and then when calling the function on an element like:
$('table tr').foo(bar, function(param) {
console.log($(this)); // this needs to reference 'table tr'
});
In cases like this, I've noticed that this references the window. How would you reference the element that the function is being called on without passing it as an argument inside the callback?
table tris double clicked, or if there's no form, just a button, to be able to specify in callback @charlietflthisinside the plugin is jQuery object with all rows in it