实现效果
点击通过时,不显示“理由”输入框
点击不通过时,显示该输入框
html
<div class="form-group">
<label class="col-sm-3 control-label is-required">审核:</label>
<div class="col-sm-8">
<input type="radio" name="shenhe" value="0">通过
<input type="radio" name="shenhe" value="1">不通过
</div>
</div>
<div class="form-group" id="div-reason">
<label class="col-sm-3 control-label is-required">理由:</label>
<div class="col-sm-8">
<textarea name="reason" class="form-control" id="reason" th:field="${jnkc.reason}" required></textarea>
</div>
</div>
jquery
$(function() {
$('#div-reason').hide();
$('input:radio[name="shenhe"]').change(function(){
var v = $(this).val();
if(v == '1'){
$('#div-reason').show();
}else {
$('#div-reason').hide();
}
});
})