I whipped up a demo.
http://www.commadot.com/jquery/forms/all.htm
var regularBoxes = $("[EMAIL PROTECTED]").not("#allToggle");
$("#allToggle").click(function(){
if ($("#allToggle").attr("checked") == true) {
regularBoxes.removeAttr("checked");
}
});
regularBoxes.click(function(){
$("#allToggle").removeAttr("checked");
});
I didn't use it but there is also a checkbox plugin. Not sure all it does.
http://www.texotela.co.uk/code/jquery/checkboxes/
Glen
On 8/17/07, 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","");
> }
> }
> });
>
>