Reputation: 928
I have a Ruby On Rails application. I want to enable the drop down list only if the check box is enabled. Please let me know a way to do this.
Thanks, Ramya.
Upvotes: 0
Views: 221
Reputation: 96897
Do it with jQuery. Add a click
handler to your element, and do your checks inside that. Here's an example of checking the checkbox: http://jquery-howto.blogspot.com/2008/12/how-to-check-if-checkbox-is-checked.html
EDIT: code could be like this:
$("#id_of_checkbox").live("click",function() {
var is_checked = $(this).is(":checked");
if(is_checked) {
// disable
}
else {
// enable
}
});
Upvotes: 2