JSFiddle: http://jsfiddle.net/dvF5d/2/
<input type="radio" id="rad1" name="rad"/><label for="rad1">rad1</label><br/>
<input type="checkbox" id="chk1"/><label for="chk1">chk1</label><br/>
<input type="radio" id="rad2" name="rad"/><label for="rad2">rad2</label>
$(document).ready(function(){
var rad1 = $('#rad1');
var chk1 = $('#chk1');
var a = function(){
if(!rad1.is(':checked'))
{
chk1.attr('disabled', true);
}
console.log('rad checked', rad1.is(':checked'));
};
rad1.blur(function(){
console.log('blur');
a();
});
rad1.change(function(){
console.log('change');
a();
});
});
When rad1 is blurred, the rad1 is checked property is always true even if rad2 is selected. Is there anyway to fix this? (or better yet, some kind of jquery plugin that enables/disables controls based on other controls).