I'm trying to get the selector used to call the current script, but of course the property I need was removed for some reason.
Is there a workaround for this? Here's basically what I want to accomplish:
(function($) {
$.fn.myplugin = function(options) {
return this.each(function() {
console.log($(this).selector);
});
}
}(jQuery));
//Somwehere else:
$('.theClassISelected').myplugin(); //Should console.log('.theClassISelected')
I need to see .theClassISelected
(or some form of the original selector I used to call the function) in the console, but since the selector property has been removed from jQuery, it doesn't possible anymore.
I don't understand why it was removed - I've Googled this problem for a while now and all I see are StackOverflow answers from 2011-2012 recommending the selector
property. I guess it was useful at some point, but not anymore?