Разметка:
<table class="form-table no-border">
<tbody>
<tr class="parent">
<th scope="row">Яндекс.Деньги<span class="description"></span></th>
<td>
<label class="switch_wrap">
<input name="option[ym]" id="ym" class="parent" value="1" type="checkbox">
<div class="switch"><span class="bullet"></span></div>
</label>
</td>
</tr>
<tr>
<th scope="row">Телефон</th>
<td>
<label class="switch_wrap">
<input name="option[ymphone]" id="ymphone" class="" value="1" type="checkbox">
<div class="switch"><span class="bullet"></span></div>
</label>
</td>
</tr>
<tr>
<th scope="row">Телефон</th>
<td>
<label class="switch_wrap">
<input name="option[ymphone]" id="ymphone" class="" value="1" type="checkbox">
<div class="switch"><span class="bullet"></span></div>
</label>
</td>
</tr>
</tbody>
</table>
Скрипт:
var $ = jQuery;
$(document).ready(function(){
var _this = $('.switch_wrap .parent');
_this.change(function(){
if (_this.attr('checked')) {
_this.parents('.parent').nextAll('tr').fadeOut();
} else {
_this.parents('.parent').nextAll('tr').fadeIn();
}
});
})
Стили:
.form-table tr{
display: none;
}
.form-table .parent{
display: block !important;
}
Подскажите, почему не работает скрипт?