Check if a Checkbox is checked

This question already has an answer here:

  • How to check whether a checkbox is checked in jQuery? 56 answers

  • Try This :-

    $('.cbFee').click(function () {
        if ($(this).is(':checked')) {   
            $('.grpAnnualFee').hide();
        } else {
            $('.grpAnnualFee').show();
        }
    });
    

    OR

    $('.cbFee').click(function () {
        if (this.checked) {   
             $('.grpAnnualFee').hide();
        } else {
             $('.grpAnnualFee').show();
        }
    });
    

    and while dealing with checkboxes it is better to use .change() instead of .click() .


    你可以使用$('.cbFee').is(':checked')

    链接地址: http://www.djcxy.com/p/9540.html

    上一篇: 使用WCF的MSMQ监听器

    下一篇: 检查复选框是否被选中