Detecting checked state of checkbox.

Detecting checked state of checkbox.

This function is getting called as it should. the line " if ($("lumode").attr('checked'))" is not detecting the state of the checkbox properly.  It always returns false so mode never gets set to 'all'.  (#lumodestate is a button I am using to test the function).

$(function(){
  $("#lumode").click(function(){
     mode = '';
     $("#lumodestate").html(mode);
     if ($("lumode").attr('checked')){
        mode = 'all';
     $("#lumodestate").html(mode);
   });
  });

I feel rather stupid in not being able to figure this one out.

Thanks in advance.
Bill






    • Topic Participants

    • bwls