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

demo


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -