<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>
//去掉html里的onclick,
$(document).ready(function(){
$("#DataList1_ctl00_DataList2_ctl00_DataList3_ctl00_RadioButton3").click(function(){
$(".reason").show();
});
})
需要用到 隐藏控件
这里有很多方法,这个只是其中一种,可以搜索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');
}
});