【问题标题】:A default in dropdownA default in dropdown
【发布时间】:2022-12-27 22:42:46
【问题描述】:

I want to have a default value in my dropdown but I dont find how to do it.

The variable is status and the value is1that is Available.

<div class="col-12">
    <strong>Estatus: &nbsp;</strong>
    <select id="status" name="status" class="form-control" autocomplete="off">
        <option>-- Seleccionar --</option>
        @foreach ($getStatus as $statusA)
            <option {{($statusA->id == $status) ? 'selected':''}} value="{{$statusA->id}}">{{$statusA->name}}</option>
        @endforeach
    </select>
</div>

Its a filter that I used I want that the client always see Available

【问题讨论】:

    标签: laravel laravel-6


    【解决方案1】:

    Add this

    <option selected disabled>-- Seleccionar --</option>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-12-02
      • 2022-12-02
      • 1970-01-01
      • 2022-12-27
      • 1970-01-01
      • 1970-01-01
      • 2022-12-28
      • 2022-12-02
      相关资源
      最近更新 更多