文本框出现在单选按钮检查 [英] Text box appear on radio button check
本文介绍了文本框出现在单选按钮检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下..
<table id='table_columns'>
<td align="center">
<input type="radio" name="WIDTH" value="1" <?php echo ($config->get('WIDTH','COLUMNS') == "1")?'CHECKED':'';?> />
<p>4 Columns</p>
</td>
<td align="center">
<input type="radio" name="WIDTH" value="2" <?php echo ($config->get('WIDTH','COLUMNS') == "2")?'CHECKED':'';?> />
<p>3 Columns</p>
</td>
<td align="center">
<input type="radio" name="WIDTH" value="3" <?php echo ($config->get('WIDTH','COLUMNS') == "3")?'CHECKED':'';?> />
<p>Custom</p>
</td>
<tr>
<td align="right">
<p>Column 1</p>
</td>
<td align="left">
<input class="txt" size="3" maxlength="3" name="WIDTH1" Title="Insert the desired width" value="<?php echo $config->get('WIDTH1','COLUMNS')?>" />
</td>
</tr>
选中自定义单选按钮后,我希望出现下面的文本框.如果选中任何其他单选按钮,我不希望它显示.我该怎么做?
When the Custom radio button is checked I would like the text box below to appear. If any of the other radio buttons are checked I don't want it to show. How would I do this?
谢谢
推荐答案
如果单选按钮映射到下一行单元格,您可以试试这个:
If the radio buttons map to the next rows cell you can try this:
<script type="text/javascript">
$(function(){
$("table input:radio").click(function(){
var $radio = $(this);
var index = $radio.closest("td").index();
$radio.closest("tr").next().find("input:text").eq(index)
.toggle($radio.is(":checked"));
});
});
</script>
或者如果下一行只有 1 个文本框,您可以尝试:
or if there is only 1 textbox in the next row you can try:
<script type="text/javascript">
$(function(){
$("table input:radio").click(function(){
var $radio = $(this);
$radio.closest("tr").next().find("input:text")
.toggle($radio.is(":checked"));
});
});
</script>
您的标记看起来无效或您只是复制/粘贴错误
Your markup looks invalid or you just copied/pasted it wrong
这篇关于文本框出现在单选按钮检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文