Check if the Checkbox with the Value X gets unchecked?

This question already has an answer here:

  • jQuery checkbox change and click event 16 answers

  • 通过checkboxex循环,然后检查如下

    var c=$(".commonclassname");
    for(var i=0;i<c.length;i++)
    {
       if(c[i].value=="your value")
       {
         //matched...
       }
    }
    

    Here's how to detect if a checkbox with a particular value gets unchecked

    $("input[type=checkbox]").click(function() {
        if ($(this).val() == "test2" && !$(this).is(":checked")) {
            alert("Unchecked Test2");
        }
    });
    

    Fiddle: https://jsfiddle.net/vwm28b7u/1/

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

    上一篇: 动态更改复选框不会触发onChange?

    下一篇: 检查值为X的复选框是否未被选中?