var others = $("#6");
others.click(function() {
    $('input:checkbox').attr('checked',false);
    $("#6").attr('checked',true);
});
I have an array of check boxes which is drawn from database. I want to uncheck other check boxes when a certain check box is ticked in my case checkbox with id #6, and it uncheck a checkbox #6 if other checkbox is check.
The code above is able to uncheck o开发者_JAVA技巧ther checkbox but how can I uncheck the checkbox with id 6,once the other checkbox is check.
$('input:checkbox').click(function() {
    if(this.id == '6' && this.checked)
        $('input:checkbox:not(#6)').attr('checked', false);
    else
        $('#6').attr('checked', false);
});
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论