jquery - each function order by class number -


i have function, search class step1, step2, step3....

$(this).find('[class*="step"]').each(function(){  } 

i want run function ordering class number, like:

<div class="myclass">     <div class="step4">..</div>     <div class="step1">..</div>     <div class="step3">..</div>     <div class="step2">..</div> </div 

now first run, step1 step2 step3 , on

i tried code:

var i=1; $(this).find('.step'+i).each(function(){     i++; } 

is above code oky?? cuz running each function on single selector

you need loop

for(var = 1; <= 4; i++){     var step = $('.step' + i);     //do step } 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -