【问题标题】:checkbox - leave checked - laravel复选框 - 选中 - laravel
【发布时间】:2021-06-10 03:24:59
【问题描述】:

如果变量不为空,我需要标记我的复选框,如果变量为空,则保持未选中状态

<div class="n-chk">
    <label class="new-control new-checkbox new-checkbox-rounded checkbox-primary">
        <input name="reingresado" checked="{{$variable->actived}}" type="checkbox" class="new-control-input">
        <span class="new-control-indicator"></span>¿Producto Reingresado?
    </label>
</div>

【问题讨论】:

    标签: php html laravel


    【解决方案1】:

    你可以像下面那样做。这里我假设reingresado的值为1

     <input name="reingresado"  type="checkbox" class="new-control-input"  {{(isset($variable->actived)&&$variable->actived==1)?"checked":""}}>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-11-28
      • 1970-01-01
      • 2022-12-15
      • 2019-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多