I have 2 checkboxes, consider chk1 and chk2. If one checkbox is checked, the second checkbox should be checked automatically and not viceversa. What should be the javascript? Can someone help me? Thank you!!
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s a simple inline version to demonstrate the general idea. You might want to pull it out into a separate function in real world usage.
If you want chk2 to automatically stay in sync with any changes to chk1, but not do anything when chk2 is clicked go with this.
This version will only change chk2 when chk1 is checked, but not do anything when ck1 is unchecked.