I'm trying to move an element inside another within the same parentThat parent has siblings with the same class, so I want to apply this on every sibling, but only for their children
At the moment it's taking all title
and moving each them inside image
, so I end up with 3 title
on each element.
What I want is to move just the title
of each item
inside the image
<div class="item"><a href="" class="image"><img src=""></a><h3 class="title"></h3> <!-- Element to move inside 'image' --></div><div class="item"><a href="" class="image"><img src=""></a><h3 class="title"></h3></div><div class="item"><a href="" class="image"><img src=""></a><h3 class="title"></h3></div>
This is what I've been trying...
$( ".item" ).each(function( index ) { $(this).find('.title').prependTo('.image');});