> 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