Question

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?

Was it helpful?

Solution

EDIT: this property is deprecated, thanks Matt for pointing this out.

jQuery objects has a selector property so you can do something like

myjQueryObj.selector
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top