jquery - Sorting elements based on condition -
html:
<div class="album"> <div class="listing"> <a href="#" class="btn hidden">button</a> </div> <div class="listing"> <a href="#" class="btn">button</a> </div> </div>
pseudo code:
in each album each listing hidden = find ('.btn.hidden') remove , append (move) hidden bottom
i'm not sure how remove elements , append?
can try like:
$('.album').each(function(){ $(this).append( $(this).find('.listing').has('.btn.hidden') ); });
append() automatically remove
Comments
Post a Comment