Jquery checkbox inside div checked one at time

前端 未结 2 1980
心在旅途
心在旅途 2021-01-20 15:42

So i have a div thats auto generated and inside are 3 check boxes with different id\'s & names and by default none of them are checked!! If one happens to get checked th

2条回答
  •  清酒与你
    2021-01-20 15:52

    I had a similar issue and solved it like so (using part of Arun P Johny's answer - I wanted to share for those of you who might come across this as well.)

    (function($checkbox,options){                               
                $($checkbox).on('change', function() {                  
                    $("input[type='checkbox']").not(this).prop('checked', false);               
                });             
            });
    

提交回复
热议问题