[jQuery] JQuery Events
[jQuery] JQuery Events
Hello,
I have the following:
$('#Professor').click(function(){
if ( this.checked ) {
$('#ProfessorField').show();
$('#SubscriptionsField').show();
} else {
$('#ProfessorField').hide();
$('#SubscriptionsField').hide();
}
})
Basically on a form I am hiding/showing a few fieldsets when a
checkbox is selected or unselected.
However, when I submit the form and there are errors, the page is
displayed again with the error messages.
The problem is that the fields get visible independently of the
checkbox Professor value.
I don't know why ... So I added the following:
$('#Professor').load(function(){
if ( this.checked ) {
$('#ProfessorField').show();
$('#SubscriptionsField').show();
} else {
$('#ProfessorField').hide();
$('#SubscriptionsField').hide();
}
})
Still does not work ... any idea why?
And since the code is the same can't I join the two events?
Thanks,
Miguel