php - 如何解决PHP中for循环准备的输入和标签的索引问题?
问题描述
我正在做我在 homepage.blade 文件中使用 for 循环创建的结构。我有这样的问题。假设我创建了 5 个输入。创建结构后按第 5 个标签时,始终激活 1.input。我该如何解决这个问题?
主页.blade.php
<h4>Checkbox</h4>
@include('items.checkbox')
@include('items.checkbox', array('error' => true))
@include('items.checkbox', array('label' => 'Inline Centered', 'labelClass'=> 'label-centered'))
复选框.blade.php
<fieldset class="form-group checkbox @if (!empty($width)){{$width}}@endif @if(!empty($labelClass)) {{$labelClass}} @endif">
<input id="checkbox{{$i}}" type="checkbox" placeholder="Option text" />
<div class="wrapper">
<label for="checkbox{{$i}}">@if (!empty($label)) {{$label}} @else Checkbox @endif *</label>
<small>Helper text goes here</small>
</div>
</fieldset>
解决方案
推荐阅读
- r - 如何更改此代码,以便 R 可以从代码中的网站正确下载文件?
- python - 监控 Artifactory 中的新工件并将工件属性发送到 API
- regex - 编写一个运行良好的正则表达式
- snowflake-cloud-data-platform - 如何从雪花屏蔽策略中的表中选择随机行?
- spring - 邮递员中的空列表,在oracle数据库中有数据,不显示数据
- google-sheets - Google表格如何去除多行的不同值?
- visual-studio - Visual Studio 19 Xamarin 错误 - “系统资源不足,无法完成请求的服务”
- r - 多个变量的整洁选择语法
- r - 如何用ggtern在一个图形上组合三个三元图
- python-3.x - 当条件已经满足时在while函数中循环?