When calling a custom plugin, how can I get the current selector string?
$(\'my_selector p\').my_plugin();
Would like to output my_se
Being deprecated, the official advice is to add the selector as a parameter in your function call: https://api.jquery.com/selector/
Plugins that need to use a selector string within their plugin can require it as a parameter of the method. For example, a "foo" plugin could be written as
$.fn.foo = function( selector, options ) { /* plugin code goes here */ };
and the person using the plugin would write
$( "div.bar" ).foo( "div.bar", {dog: "bark"} );
Redundant, yes, but it's always reliable.