Drupal 5: Validating checkboxes in a form using jQuery

I created a form using the Drupal forms API that contained a set of checkboxes. Here is the jQuery I added to validate the checkboxes and ensure at least one is checked before submitting the form.

$(document).ready(function(){
  $('form#MYFORMID').submit(function(){
    isChecked = false;
    $('input[@type="checkbox"]', this).each(function(){
      if ($(this).attr('checked')) isChecked = true;
    });
    if (isChecked) return true;
    return false;
  });
});

Updated: