Question

I'm pretty new to jquery and need some help.

I'm trying to clone a copy of the closest ancestor with class 'hidden' of $el and then look for $el's copy in the clone ancestor($hidden).

var $hidden = $el.closest('.hidden'),
    $substitute = $hidden
        .clone()
        .appendTo($hidden.parent());

Then I try to find $el's copy in $substitute. I tried this:

$substitute.find($el);

But it doesn't work..

Any help would be appreciated.

Was it helpful?

Solution

You can try adding a data attribute to $el and then doing a $substitute.find('[your-data-attrib]') call

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