复选框变成单选

 $(function () {
        $(":checkbox").click(function () {
            //设置当前选中checkbox的状态为checked
            $(this).attr("checked", true);
            $(this).siblings().attr("checked", false); //设置当前选中的checkbox同级(兄弟级)其他checkbox状态为未选中
        });
    });

猜你喜欢

转载自www.cnblogs.com/Kirins/p/10328673.html