我想指定一个更好的代码,这将触发输入无线电和执行专用文本字段。
这就是我要说的(对不起,我不太擅长jquery,所以请原谅我)。除了我的代码中列出的原始32份问卷之外,我只发布了2个样本。
<table width="817" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="317" height="25">1. Use of adjoining property</td>
<td width="10" height="25">:</td>
<td width="480" height="25">
<input type="radio" name="no1" value="Yes" />Yes
<input type="radio" name="no1" value="No" />No
</td>
</tr>
<tr class="notes">
<td height="25" align="right">Notes</td>
<td height="25">:</td>
<td height="25">
<input name="notes1" type="text" id="notes1" size="65" value="" />
</td>
</tr>
<tr>
<td height="25">3. Access to dirt or paved road</td>
<td height="25">:</td>
<td height="25">
<input type="radio" name="no3" id="radio8" value="Yes" />Yes
<input type="radio" name="no3" id="radio9" value="No" />No
</td>
</tr>
<tr class="notes">
<td height="25" align="right">Notes</td>
<td height="25">:</td>
<td height="25">
<input name="notes3" type="text" id="notes3" size="65" value="" />
</td>
</tr>
</table>我确实尝试创建了每个jquery,但希望简化代码。
var notes = $('tr.notes');
notes.hide();
$('input[value="Yes"]').click(function () {
notes.slideDown();
});我确实在这里做了一些研究,但不能详细说明结构。我很感谢你的帮助。非常感谢。
发布于 2013-01-18 13:55:11
这将尝试检测输入单选框是否更改,它将检测是否被单击,它将检查该值并显示注释。
$('.notes').hide();
$('input[type="radio"]').change(function () {
if ($(this).val() == "Yes") {
$(this).closest('tr').next('tr.notes').slideDown();
} else {
$(this).closest('tr').next('tr.notes').slideUp();
}
});请检查以下内容:Demo
https://stackoverflow.com/questions/14393128
复制相似问题