📜  更改复选框 jquery 警报 - Javascript 代码示例

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

代码示例4
$(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);        
    });
});