The jQuery.wrapAll function takes a dom subtree and wraps it around a jQuery object. I want to do that but without aquiring the target jQuery object via selector: I have a bunch of references to jQuery wrapped DOM elements and I want to apply wrapAll to all of them. Is it possible to do it without assigning a common class and selecting them through the class?
You can add elements to a jQuery object using the add
function. add
accepts a selector (adds matching elements), a raw DOM element (adds it), an HTML fragment (creates the element(s) and adds them), and a jQuery object (adds all of the elements in it). That last probably matches what you're looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With