[jQuery] toggle a checkbox???

[jQuery] toggle a checkbox???


Hi all,
I am new to this forum and hope someone can direct me a little..
I have a checkbox that needs to be checked/unchecked under the following
rules..
if any checkboxes with id like "REQ_ACCT_LAB_" are checked, then check it
if all of the checkboxes with id like "REQ_ACCT_LAB_" are unchecked, then
uncheck it.
Is there a better way of doing this?
heres my code:
if ($("input[name^=REQ_ACCT_LAB_]").is(":checked"))
{
$("input[name=MY_CHK]").attr("checked","checked");
}
else
{
$("input[name=MY_CHK]").attr("checked","");
}
Thanks!
--
View this message in context: http://www.nabble.com/toggle-a-checkbox----tp22233470s27240p22233470.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.