首页 新闻 搜索 专区 学院

jquer 实现如何显示和隐藏下一级div

0
悬赏园豆:20 [待解决问题]

<div class="btn-group">
<label class="btn btn-success" width="80px">
<span autocomplete="off" style="display:inline-block;width:40px;">
<input id="DataList1_ctl00_DataList2_ctl00_DataList3_ctl00_RadioButton1" type="radio" name="DataList1$ctl00$DataList2$ctl00$DataList3$ctl00$pj" value="RadioButton1" />
<label for="DataList1_ctl00_DataList2_ctl00_DataList3_ctl00_RadioButton1">满意</label></span>
</label>
<label class="btn btn-warning" width="80px">
<span autocomplete="off" style="display:inline-block;width:65px;"><input id="DataList1_ctl00_DataList2_ctl00_DataList3_ctl00_RadioButton2" type="radio" name="DataList1$ctl00$DataList2$ctl00$DataList3$ctl00$pj" value="RadioButton2" /><label for="DataList1_ctl00_DataList2_ctl00_DataList3_ctl00_RadioButton2">基本满意</label></span>
</label>
<label class="btn btn-danger" width="80px">
<span autocomplete="off" style="display:inline-block;width:50px;">
<input id="DataList1_ctl00_DataList2_ctl00_DataList3_ctl00_RadioButton3" type="radio" name="DataList1$ctl00$DataList2$ctl00$DataList3$ctl00$pj"
value="RadioButton3" onclick="showindex(this);" />
<label for="DataList1_ctl00_DataList2_ctl00_DataList3_ctl00_RadioButton3">不满意</label></span>
</label>
</div>
<div id="DataList1_ctl00_DataList2_ctl00_DataList3_ctl00_lblreason" style="margin-top: 10px; margin-bottom: 5px; display:none;" class="reason">
说明: <input name="DataList1$ctl00$DataList2$ctl00$DataList3$ctl00$txtReason" type="text" id="DataList1_ctl00_DataList2_ctl00_DataList3_ctl00_txtReason" />
</div>

点击【不满意】的时候弹出下面隐藏的div

问题补充:

我现有的js

<script type="text/javascript">
function showindex(obj) {
$(obj).parent().parent().parent().find("div.btn-group").next("div.reason").show();
}
</script>

郭二的的主页 郭二的 | 初学一级 | 园豆:182
提问于:2015-06-07 21:20
< >
分享
所有回答(3)
0

//去掉html里的onclick,

$(document).ready(function(){
$("#DataList1_ctl00_DataList2_ctl00_DataList3_ctl00_RadioButton3").click(function(){
$(".reason").show();
});
})

DeadLoop | 园豆:204 (菜鸟二级) | 2015-06-08 09:26
0

需要用到 隐藏控件

wpw | 园豆:26 (初学一级) | 2015-06-08 10:21
0

这里有很多方法,这个只是其中一种,可以搜索jquery选择器来看看。可以互相学习下。

页面:

<div id="divRadio">
        <input type="radio" id="One" name="One" />满意
        <input type="radio" id="Two" name="One" />基本满意
        <input type="radio" id="Three" name="One" />不满意

</div>
<div id="divThree" style="display:none;">不满意的时候我才出来的!</div>

js:

$('#divRadio [name=One]').unbind('click').on('click',function(event){
        if($(this).attr('id')=='Three')
        {
            $('#divThree').css('display','block');
        }
        else
        {
            $('#divThree').css('display','none');
        }
});

dinoy | 园豆:160 (初学一级) | 2015-06-08 15:19
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册