layui实现根据后端数据库传值显⽰或隐藏-js中获取php传递的值html代码部分
<div class="layui-row margin-bottom-15">
textarea中cols表示<label class="layui-col-xs2 think-form-label">⾏政处罚记录</label>
{switch$data['is_penalize']}
{case0}
<input type="radio" name="is_penalize" value="1" title="是" lay-filter="testRadio">
<input type="radio" name="is_penalize" value="0" title="否" checked lay-filter="testRadio">
{/case}
{case1}
<input type="radio" name="is_penalize" value="1" title="是" checked lay-filter="testRadio">
<input type="radio" name="is_penalize" value="0" title="否" lay-filter="testRadio">
{/case}
{/switch}
<!--<input type="radio" name="is_penalize" value="1" title="是">
<input type="radio" name="is_penalize" value="0" title="否">-->
</div>
<div class="layui-row margin-bottom-15" id="contentss" >
<label class="layui-col-xs2 think-form-label">处罚原因</label>
<div class="layui-col-xs8">
<textarea name="penalize_reason" id="content"class="layui-textarea" cols="30" rows="10" >
{$data['penalize_reason']}
</textarea>
</div>
</div>
js代码
var is_penalize_show ="{$data['is_penalize']}";
if(is_penalize_show==1)
{
$("#contentss").css("display","block");
}else{
$('#contentss').css('display','none');
}
<('radio(testRadio)',function(data){
if(data.value =='1'){
$("#contentss").css("display","block");
}else{
$("#contentss").css("display","none");
}
});
显⽰结果页

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。