如何让checkbox复选框只能单选

  1. $("#txm").find(".checkbox").each(function(){  
  2.                                             
  3.    $(this).click(function(){  
  4.                             
  5.     var test= $(this).attr("checked");   
  6.       
  7.     if(this.checked){  
  8.         GetData(this.value);  
  9.      $(this).parent("div").siblings().children(".checkbox").each(function(){  
  10.                                                                             
  11.       if(test== this.checked){  
  12.             
  13.        this.checked = false;   
  14.       }  
  15.         
  16.      });  
  17.        
  18.     }   
  19.       
  20.    });  
  21.      
  22.   });  
  23.   
  24.   
  25. }); 

posted on 2017-07-17 10:35  Mike17  阅读(3992)  评论(0编辑  收藏  举报

导航

搜狗