Hiding some form elements
Hi
I want to show or hide some tags of registration form with changing a combo
I wrote this code :
$('select[name=user_type]').change(function(){
FormType = $('select[name=user_type]').val();
switch (FormType)
{
case 'teacher': $('.teacher_form').show();
$('.student_form').hide();
break;
default: $('.teacher_form').hide();
$('.student_form').show();
}
})
But when the user_type combo changes nothing happens !
This is a piece of my form :
<tr>
<td>
Post
</td>
<td>
<select name="type" >
<option value="student" selected="selected">Teacher</option>
<option value="teacher">Student</option>
</select>
</td>
</tr>
<tr class="student_form">
<td>
Student ID
</td>
<td>
<input type="text" name="Personal_id">
</td>
</tr>
<tr class="teacher_form">
<td>
User ID
</td>
<td>
<input type="text" name="Personal_id">
</td>
</tr>
Thanks