gpt4 book ai didi

jquery - 防止元素被制表

转载 作者:行者123 更新时间:2023-11-28 09:17:03 25 4
gpt4 key购买 nike

我有以下 html 标记:

    <tr class="table_row">
<td tabindex="-1" class="delete_row"><button class="btn btn-small btn-danger">X</button></td>
<td>
<span class="row0" contenteditable="true">Text 1</span>
</td>
<td>
<span id="tourCellData" class="row0" contenteditable="true">Text 2</span>
</td>
<td>
<span class="row0" contenteditable="true">Text 3</span>
</td>
<td>
<span class="row0" contenteditable="true">Text 4</span>
</td>
<td>
<span class="row0" contenteditable="true">Text 5</span>
</td>
</tr>

我正在寻找方法来防止带有“.delete_row”类的元素被标记。我搜索了 StackOverflow,发现 'tabindex="-1"' 应该可以完成这项工作。但这对我不起作用。

我找到了一个使用 jQuery 的解决方案:

$("#parentSelector").on("focus", ".delete_row", function () {
$(this).next().find("span").focus();
});

是否有不使用 jQuery 的替代解决方案?

最佳答案

这里是解决方案 Fiddle

tabindex="-1" 添加到您的按钮元素

 <td class="delete_row"><button tabindex="-1" class="btn btn-small btn-danger">X</button></td>

关于jquery - 防止元素被制表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26264657/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com