Fantastic solution, really cut the code down! Thank you very much! On Aug 18, 8:59 am, Pops <[EMAIL PROTECTED]> wrote: > How about just: > > $('[EMAIL PROTECTED]').click(function() { > if (this.id == "categoryid0") { > $('[EMAIL PROTECTED]').attr("checked",""); > this.checked = true; > } else { > $('input#categoryid0').attr("checked",""); > } > > }); > > Basically, by the time the click handler is caledl, the GUI system has > already changed the state of the box. It is checked or unchecked for > you so you don't need to repeat this checking/unchecking process in > the else block. This means you don't need temp variable and can > directly compare for id == "categoryid0". This has string some > overhead reduction benefits since there is no need for replace. In the > same vain, for the same block, the local scope "this" is for > categoryid0. So need for further use jQuery overhead to burn in the > check - go directly with this.checked = true. > > -- > HLS > > On Aug 17, 2:10 pm, TigeRyan <[EMAIL PROTECTED]> wrote: > > > > > Someone want to help trim this function down some? What it does is > > take a list of checkboxes and if someone selects "ALL" it turns off > > all the other boxes and checks, if someone selects any other box it > > turns off "ALL" and allows the others to light up. > > > $('[EMAIL PROTECTED]').click(function() > > { > > temp = this.id.replace("categoryid",""); > > > if (temp == 0) > > { > > $('[EMAIL PROTECTED]').attr("checked",""); > > $('input#categoryid0').attr("checked","checked");} > > > else > > { > > $('input#categoryid0').attr("checked",""); > > > if ($(this).is(":checked")) > > { > > $('input#categoryid'+temp).attr("checked","checked");} > > > else > > { > > $('input#categoryid'+temp).attr("checked",""); > > > } > > } > > });- Hide quoted text - > > - Show quoted text -