"appendTo / after" each item with $(this)?
Hi!
I'm trying to move a div inside a container for each instance of that class.
But when using the script below, it moves every single matching div below all the matching "group fields".
My jQuery now:
$('.field-1').insertAfter('.group .field-2');
The code:
<div class="container container-1">
<div class="field-1"></div>
<div class="group">
<div class="field-2"></div>
</div>
</div>
<div class="container container-2">
<div class="field-1"></div>
<div class="group">
<div class="field-2"></div>
</div>
</div>
I want to move the div
"field-1" after/below
"field-2" for each repeating container.
A little help? I'm guessing that I need a small function that uses $(each) or $(this)?
Regards,
Mattias