Run each function multiple times (until condition is meet)
I'm trying to do this:
- while (getStakeAmount() <= maxAmount){
- $('#tabs-' + active + ' .connectedSortable').each(function () { // For each UL
- $(this).children().each(function () { // For each LI
- // Do stuff
- });//End li
- });//End UL
- }
I'm trying to repeat the each function for all the UL's, as long as condition is not meet, but nothing happens and the browser gets locked.
What can be wrong?
On the other hand this works, but is only repeated once for each UL. That is when changing the while to an if-statement:
- if (getStakeAmount() <= maxAmount){
- $('#tabs-' + active + ' .connectedSortable').each(function () { // For each UL
- $(this).children().each(function () { // For each LI
- // Do stuff
- });//End li
- });//End UL
- }
There's 7 UL's and when the condition is not meet I would need to go through all the UL's a second round or more.