<li>
<label class="feiyonglabel">活动费用</label>
<div class="textbox textbox2">
<label><input type="radio" name="hdprice" data-type="1" class="hdprice"> 免费</label>
<label id="charge" data="on"><input type="radio" name="hdprice" class="hdprice" value="1" data-type="2"> 收费</label>
</div>
<div class="feiyong"><input class="" type="text"> 元/每人</div>
</li>
<script>
$('.hdprice').click(function(){
var attr = $(this).attr('checked');
if($(this).attr('data-type')=='2'){
if(attr=='checked'){
$('.feiyong').css('visibility','visible');
}
} else{
$('.feiyong').css('visibility','hidden');
}
});
</script>
例子2:
<div class="form-group">
<label class="control-label">申请类型:</label>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 lineheight lineheightlx">
<label><input type="radio" name="leixinra" data='sc' />商城</label>
<label><input type="radio" name="leixinra" data='wm' />外卖(包括商城)</label>
</div>
</div>
<script>
$(function(){
var datatype = $('.lineheightlx input:radio[name="leixinra"]:checked').attr('data');
if(datatype=='wm'){
$('.yincangcontent').show();
} else{
$('.yincangcontent').hide();
}
$('.lineheightlx input').click(function(){
var datatype2 = $('.lineheightlx input:radio[name="leixinra"]:checked').attr('data');
if(datatype2=='wm'){
$('.yincangcontent').show();
}else{
$('.yincangcontent').hide();
}
});
});
</script>