HTML
<form class="layui-form special_form_upload"> <!-- 提示:如果你不想用form,你可以换成div等任何一个普通元素 --> <div class="layui-form-item"> <label class="layui-form-label ">资源类别</label> <div class="layui-input-block special_form_change"> <input lay-filter="testRadio" type="radio" name="change" title="教学设计" value="1" lay-skin="primary" checked> <input lay-filter="testRadio" type="radio" name="change" title="应用案例" value="2" lay-skin="primary"> <input lay-filter="testRadio" type="radio" name="change" title="教学素材" value="3" lay-skin="primary"> <input lay-filter="testRadio" type="radio" name="change" title="课堂实录" value="4" lay-skin="primary"> </div> </div> </form>
JS
layui.use('form', function () { var form = layui.form; form.on('radio(testRadio)', function (data) { console.log(1111,data.value) if (data.value == '1'||data.value=="2") { $("#resonDiv").css("display", "block"); } else { $("#resonDiv").css("display", "none"); } }); })