i have a time dropdown that shows hour in one select, minutes in another and AM/PM in a third. I have a checkbox that says “All day”
i want it so when the user checks on “All day” all of the select dropdowns become disabled.
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.
The trouble with checkboxes is principally getting them to work right in IE6, since the
changeevent fires at all manner of unhelpful times.Let’s start with the function to do the disabling:
Note that I here use just
selectwhich is almost certainly more broad than you’d want, butselect.some-class-to-identify-the-hours-and-minutes-and-seconds-dropdownswould work just as well.Note also that the function figures out itself whether the box is checked, making it idempotent: it’s safe to call repeatedly during the process of checking a box.
Now we just need to bind that function to a few different events: