Home  >  Article  >  Web Front-end  >  jqueyr判断checkbox组的选中(示例代码)_jquery

jqueyr判断checkbox组的选中(示例代码)_jquery

WBOY
WBOYOriginal
2016-05-16 17:16:53985browse

html:

复制代码 代码如下:

 
                       
                       
                       
                            批准   
                            不批准
                       
                   

jquery :
复制代码 代码如下:

$(function () {
    $(".checkboxListItem").change(    //教师
        function () {
            var $checkValue = $("input[name='checkItem']:checked").val();
            if ($checkValue == 3) {
                $("#slsa_approval").attr("checked", true);
                $("#slsa_noApproval").attr("checked", false);
            }
            else {
                $("#slsa_approval").attr("checked", false);
                $("#slsa_noApproval").attr("checked", true);
            }
        });
});

通过值的判断:
复制代码 代码如下:

 var checkCheckbox = $("#slsa_approval").attr("checked");
        if (checkCheckbox == true) {
            auditState = "3";
        } else {
            auditState = "4";
        }
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn