Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable other checkbox on click of one check box?

I have a group of check boxes with same name, what I need is when I click any one of them, other checkboxes must get disabled. how should I apply Javascript over it?

<input type="checkbox" name="finallevelusers[]" value="1"/>
<input type="checkbox" name="finallevelusers[]" value="1"/>
<input type="checkbox" name="finallevelusers[]" value="1"/>
<input type="checkbox" name="finallevelusers[]" value="1"/>

Please help...

like image 689
OM The Eternity Avatar asked Nov 25 '25 07:11

OM The Eternity


1 Answers

You could do

$('input').attr('disabled',true);

...if you really need it. But you might be better off using radio buttons.

Try the demo

like image 78
bozdoz Avatar answered Nov 27 '25 21:11

bozdoz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!