Run each function multiple times (until condition is meet)

Run each function multiple times (until condition is meet)

I'm trying to do this:
  1. while (getStakeAmount() <= maxAmount){
  2.   $('#tabs-' + active + ' .connectedSortable').each(function () { // For each UL
  3. $(this).children().each(function () { // For each LI
  4.              // Do stuff
  5.         });//End li            
  6.   });//End UL
  7. }

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:

  1. if (getStakeAmount() <= maxAmount){
  2.   $('#tabs-' + active + ' .connectedSortable').each(function () { // For each UL
  3. $(this).children().each(function () { // For each LI
  4.              // Do stuff
  5.         });//End li            
  6.   });//End UL
  7. }
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.