📜  jquery 复选框更改事件 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:09.093000             🧑  作者: Mango

代码示例6
$(document).ready(function() {
    //set initial state.
    $('#textbox1').val(this.checked);

    $('#checkbox1').change(function() {
        if(this.checked) {
            var returnVal = confirm("Are you sure?");
            $(this).prop("checked", returnVal);
        }
        $('#textbox1').val(this.checked);        
    });
});