How do I determine if a checkbox is checked?

前端 未结 9 2095
我在风中等你
我在风中等你 2020-11-27 05:23

For some reason, my form does not want to get the value of a checkbox... I am not sure if it is my coding or not, but when I try and alert() the value, I get

9条回答
  •  无人及你
    2020-11-27 06:09

    You can use this code, it can return true or false:

    $(document).ready(function(){
      
      //add selector of your checkbox
    
      var status=$('#IdSelector')[0].checked;
      
      console.log(status);
    
    });

提交回复
热议问题