【问题标题】:generate tabindex dynamically for table row input elements [duplicate]为表格行输入元素动态生成tabindex [重复]
【发布时间】:2017-09-25 01:52:22
【问题描述】:

我需要为表中的所需元素生成 tabindex,因为行是从 foreach 循环生成的,一行中包含三个元素...

<table id="cart-table" class="form-group mb0 center-al check-number" role="grid">
<c:forEach items="${xyz.abc}" var="entry" varStatus="status">
<tr class="entry-row">
        <td class="col-product-reason">
            <select id="select${entry.index}"   class="form-control" >
                <option value="${entry.displayCode}">
                    ${entry.displayValue}
                </option>
            </select>
        </td>
        <td class="col-product-quantity">
            <span><input type="text" id="quantity1-${entry.index}" class="small-input form-control"/></span>
            <span><input type="text" id="quantity2-${entry.index}" class="small-input form-control"/></span>
        </td>
</tr>
</c:forEach>
</table>

这是我的代码sn-p,我自己试过用以下方式生成tabindex

<tr><td><select tabindex="0">//options</select></td><td><input type="text" tabindex="1"/><input type="text" tabindex="2"/></td></tr>
<tr><td><select tabindex="3">//options</select></td><td><input type="text" tabindex="4"/><input type="text" tabindex="5"/></td></tr>
<tr><td><select tabindex="6">//options</select></td><td><input type="text" tabindex="7"/><input type="text" tabindex="8"/></td></tr>

但是我想不出一个逻辑来解决这个问题。请给我任何想法

【问题讨论】:

    标签: jquery jsp


    【解决方案1】:

    只需在&lt;tr class="entry-row"&gt; 之后添加&lt;td&gt;&lt;c:out value="${status.count}" /&gt;&lt;/td&gt;。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-02-20
      • 1970-01-01
      • 2020-05-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多