Переключение блока из radio
by foxss
HTML
<table> <tr>
<td>от выбора здесь</td>
<td id="usergroup">
<label>
<input type="radio" name="ruserusergroup" value="4" checked="checked"> Работник
</label><br>
<label>
<input type="radio" name="ruserusergroup" value="7"> Работодатель
</label>
</td>
</tr>
<tr>
<td>выберается блок здесь:</td>
<td id="statusconf1">
<label>
<input type="radio" name="ruserSTATUS1" value="Ищу работника"> Ищу работника
</label><br>
<label>
<input type="radio" name="ruserSTATUS1" value="Не ищу работника" checked="checked"> Не ищу работника
</label><br>
</td>
<td id="statusconf">
<label>
<input type="radio" name="ruserSTATUS" value="Ищу работника"> Ищу работу
</label><br>
<label>
<input type="radio" name="ruserSTATUS" value="Не ищу работника" checked="checked"> Не ищу работу
</label><br>
</td>
</tr>
</table>
CSS
tr{
background: #fff;
}
td{
border:1px solid;
border-radius:5px;
margin: 3px;
padding:5px;
}
JavaScript
$('#usergroup input').change(function(){
if ($('#usergroup input[name="ruserusergroup"]').prop('checked')) {
$('#statusconf1 input').prop('disabled', true);
$('#statusconf1').hide(300);
$('#statusconf input').prop('disabled', false);
$('#statusconf').show(300);
}else{
$('#statusconf input').prop('disabled', true);
$('#statusconf').hide(300);
$('#statusconf1 input').prop('disabled', false);
$('#statusconf1').show(300);
}
}).change();