I have this code here:
$('#packageDateStopRenewalCheckedx').bind('check', function(){
$(this).attr('checked', 'checked');
});
$('#packageStatus').live('change', function(){
$('#packageDateStopRenewalCheckedx').trigger('check');
});
Both of the elements are live, so I’m getting this error on line 5:
$("#packageDateStopRenewalCheckedx") is null
How do I work around this? Basically what I need is that when a select #packageStatus changes, a checkbox #packageDateStopRenewalCheckedx is being checked.
Any help?
Try this:
But please post your HTML as well.. I can not see how your first function is triggered twice.
Also, why use ‘live’. Can’t see that from your code?