如何让checkbox复选框只能单选?

2025-04-23 18:11:51
推荐回答(1个)
回答1:

  • $("#txm").find(".checkbox").each(function(){  

  • $(this).click(function(){  

  • var test= $(this).attr("checked");   

  • if(this.checked){  

  • GetData(this.value);  

  • $(this).parent("div").siblings().children(".checkbox").each(function(){  

  • if(test== this.checked){  

  • this.checked = false;   

  • }  

  • });  

  • }   

  • });  

  • });  

  • });