Set the disabled property of the drop down list based on the state of the check boxon loading the page
In my application I want to enable a dropdown list box only when the check box is checked and disable it when the check box is unchecked. I am able to achieve this through jquery. The issue I am seeing if I had selected the check box and do a refresh it takes the default value i.e disabled=true for the check box.
Is there a way to set the disabled property of the dropdown list based on the state of the check box while开发者_开发知识库 loading the page.
you can check the state of the checkbox when your page loads, instead of hardcoding it to disabled.
So when the page loads depending upon the status of the checkbox the dropdown status can be updated.
$(document).ready(function() {
var is_checked = $('#checkBox').attr('checked');
// handle the drop down
});
精彩评论