How to disable checkbox one after another?

Posted by spotlightsnap on Stack Overflow See other posts from Stack Overflow or by spotlightsnap
Published on 2012-07-11T03:08:14Z Indexed on 2012/07/11 3:15 UTC
Read the original article Hit count: 87

Filed under:
|

I have two checkboxes with different names:

<input type="checkbox" name="checkbox1" value="checkbox1">
<input type="checkbox" name="checkbox2" value="checkbox2">

I'd like to implement code where when checkbox1 is checked, checkbox2 is disabled and when checkbox2 is checked, checkbox1 is disabled. When it's unchecked, it should enable the other back as well.

How can I achieve with jQuery or JavaScript?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery