Check if checkbox is checked with jQuery

后端 未结 23 3093
忘了有多久
忘了有多久 2020-11-21 23:12

How can I check if a checkbox in a checkbox array is checked using the id of the checkbox array?

I am using the following code, but it always returns the count of ch

23条回答
  •  情话喂你
    2020-11-22 00:04

    Just to say in my example the situation was a dialog box that then verified the check box before closing dialog. None of above and How to check whether a checkbox is checked in jQuery? and jQuery if checkbox is checked did not appear to work either.

    In the end

    
    
    
    var fd=$('.cb#fd').is(':checked');
    var rd= $('.cb#rd').is(':checked');
    

    This worked so calling the class then the ID. rather than just the ID. It may be due to the nested DOM elements on this page causing the issue. The workaround was above.

提交回复
热议问题