eg:
<div class="form-group"> <label class="col-sm-2 control-label">是否输出</label> <div class="col-sm-4"> <label class="radio-inline"> <input type="radio" name="need_dunning" value="2" class="shouchu_radio" checked> 否 </label> <label class="radio-inline"> <input type="radio" name="need_dunning" value="1" class="shouchu_radio"> 是 </label> </div> </div> <div class="form-group cuishou" style="display: none;"> <label class="col-sm-2 control-label">APIKEY</label> <div class="col-sm-4"> <input type="text" class="form-control" name="service_key" value=""> </div> </div> <div class="form-group cuishou" style="display: none;"> <label class="col-sm-2 control-label">PASSWORD</label> <div class="col-sm-4"> <input type="text" name="service_secret" class="form-control" value=""> </div> </div>
radio 触发机制
$("input:radio.shouchu_radio").on('change', function(event) { if ('1' == $(this).val()) { $("div.cuishou").css({ display: 'block' }); } else { $("div.cuishou").css({ display: 'none' }); } });