【发布时间】:2021-09-02 04:31:00
【问题描述】:
我想选中第一个 ID 为 checkAll 的复选框,它会选中我所有的复选框,当我取消选中它时,它也会全部取消选中。
我的刀锋index.blade.php:
<body>
<table class="table">
<thead>
<tr>
<th scope="col">
<input type="checkbox" id="checkAll">
</th>
<th scope="col">id</th>
<th scope="col">title</th>
<th scope="col">Paragraph</th>
</tr>
</thead>
@foreach ($categories as $categorie)
<tbody>
<tr>
<td>
<input type="checkbox" name="checkOne" value="{{$categorie->id}}">
</td>
<th scope="row">{{ $categorie->id }}</th>
<td>{{ $categorie->Title }}</td>
<td>{{ $categorie->Paragraph }}</td>
<form action={{ route('categorie.destroy', $categorie->id) }} method="POST">
@csrf
@method('DELETE')
<td>
<button class="btn btn-danger" type="submit">
delete
</button>
</form>
<button class="btn btn-warning"> <a href={{ route('edit', $categorie->id) }}>edit</a> </button>
</td>
</tr>
</tbody>
@endforeach
</table>
</body>
【问题讨论】:
标签: php laravel laravel-blade laravel-8