Thx, that does clean it up a lot. =)

As for normal being default for show and hide, I think the default doesn't
work correctly, or there is no default. Testing it blank in IE7 and
Firefox2, the checkboxes disapear faster than when set to normal setting.


Karl Rudd wrote:
> 
> You could combine those two and stick them both in the document HEAD,
> since they both run on "ready" (see other email for why).
> 
> There's no need to for the "filter()" function in this case, the
> "each()" function will do fine. Both iterate over the collection of
> objects, but "filter" is meant for "filtering", as in removing some
> elements.
> 
> Hmmm and there's some other small optimisations. For example factoring
> the hide/show code into it's own function. Can change
> "[EMAIL PROTECTED]'checkbox']" to ":checkbox".
> 
> Also "normal" is default for show() and hide().
> 
> If I may suggest the following (untested):
> 
> $(document).ready(function(){
> 
>       function visibleCheck() {
>               var $this = $(this);
>               var ul = $this.siblings("ul");
>               if ($this.is(":checked"))
>                       ul.hide();
>               else
>                       ul.show();
>       }
>       
>       $(":checkbox")
>               .click(visibleCheck)
>               .each(visibleCheck);
> });
> 
> Karl Rudd
> 

-- 
View this message in context: 
http://www.nabble.com/Loop-Checkbox-Action-Question-tf3246372.html#a9079695
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to