Hi,

> Just putting in my vote for John's method. To me it makes sense, and would
> mean I wouldn't have to keep track of numerous ".end()"s

You wouldn't nedd that with my aproach as well. Actually you could easily tell 
if you need to call end() - simply by looking at the function name. With 
Jhons solution you have to look if the function-call provides a 
context-function. See the difference:

Johns aproach:

// add class to all divs with class hideme
var count = 0;
$('div.hideme').hide().filter('.showme',function() {
        count++;
        $(this).show();
}).addClass('test');

// add class to all divs with class hideme and showme

$('div.hideme').hide().filter('.showme').each(function() {
        count++;
        $(this).show();
}).addClass('test');

My aproach:

// add class to all divs with class hideme
$('div.hideme').hide().filterend('.showme',function() {
        count++;
        $(this).show();
}).addClass('test');

// add class to all divs with class hideme and showme
$('div.hideme').hide().filter('.showme',function() {
        count++;
        $(this).show();
}).addClass('test');

Christof

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to