mercredi 4 février 2015

Process through the checked checkboxes one by one in jQuery

What I have done so far is that I have got all checked checkbox (with same name). I am using $.each() function to iterate through them But I need it to be synchronized.



jQuery.each(jQuery("input[name='checkboxes_name']:checked"), function(){
if (jQuery(this).val()=='some_val') { // processing goes here}
if (jQuery(this).val()=='some_val2') { // processing goes here}
}


Whats happening now is that it enter IF statement when condition is met and moves on to next iteration of EACH function. That way it starts executing multiple IF statement simutaneously. What I need to do is Next iteration does not start until processing is done whichever IF statement is true.


I hope you guys understand.





Aucun commentaire:

Enregistrer un commentaire