to be honest I'm not sure how to technically ask about my current need, so I'll try show it using some pseudo code.
I'm building a jQuery plugin and I need to return 'targeted element's DOM' - something like this:
plugin usage:
$('div.targeted-dom-element').myPlugin();
and inside my plugin I want to return/reuse somewhere this 'div.targeted-dom-element' string (not object please!) - is there any jquery/js built-in function for such thing?
Note that the selector
property used in this answer was deprecated in jQuery 1.7 and then removed in jQuery 3.0.
jQuery objects has a selector
property so you can do something like
myjQueryObj.selector