Я работаю над длинной формой, в которой есть несколько групп переключателей.
Внизу есть переключатель "Нет всего". Когда он выбран, я хотел бы сделать так, чтобы были выбраны все кнопки «N», но я не могу заставить его работать Вот упрощенная версия кода:
JQuery:
$(document).ready(function(){
//initially hide the Remove All Questions
$("div.#removeAllquest").hide();
//////////// Show Remove All Questions if radio button selected
$("input.#RemoveAll").click(function() {
if ($(this).is(':checked'))
$("input:radio [class*='radioR']").attr("checked",true);
else
$("input:radio [class*='radioR']").attr("checked",false);
});
});
Форма:
<table>
<tr>
<td>Y<input type="radio" name="row1" value="row1col1" class="q123col1"></td>
<td>N<input type="radio" name="row1" class="radioR" value="row1col2"></td>
<td>M<input type="radio" name="row1" value="row1col3" class="q123col3"></td>
</tr>
<tr>
<td>Y<input type="radio" name="row2" value="row2col1" class="q123col1"></td>
<td>N<input type="radio" name="row2" class="radioR" value="row2col2"></td>
<td>M<input type="radio" name="row2" value="row2col3" class="q123col3"></td>
</tr>
<tr>
<td>Y<input type="radio" name="row3" value="row3col1" class="q123col1"></td>
<td>N<input type="radio" name="row3" class="radioR" value="row3col2"></td>
<td>M<input type="radio" name="row3" value="row3col3" class="q123col3"></td>
</tr>
<tr>
<td colspan="2">No All </td>
<td>
<input name="RemoveAll" id="RemoveAll" type="radio" value="Y">
</td>
</tr>
</table>
Что я делаю не так?