Michael! So great to see you on the list again! You have a brilliant mind, and I always learn something new whenever you post.

I was beginning to wonder where you've been. Glad to have you back. :-)


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Apr 28, 2007, at 5:33 AM, Michael Geary wrote:


From: Ian Struble
Just out of curiosity is there a way to break out while
iterating with .each()? Again building on the previous
example (Mike's #2 this time):

$(function() {
   $('tr').each( function() {
       var allEmpty = true;
       $('td', this).each(funcion() {
           if(this.innerHTML !== ' ' ) {
               allEmpty = false;
               // Is it possible to break out of the td.each() here?
           }
       });
       allEmpty && $(this).addClass( 'allEmptyTds' );
   });
});

Indeed there is, return false. See my #1 example which is similar to
yours...

The for loop version is probably faster, though.

Fastest of all would be to use straight DOM code. It's not much more work,
and if this really were a performance bottleneck it could be worth it.

-Mike


Reply via email to