Javascript/JQuery 从 tabindex 中删除

发布于 2024-08-16 11:04:58 字数 467 浏览 4 评论 0原文

在 HTML 表单上,我有 INPUT 文本框,后跟一个链接,然后是另一个 INPUT 文本框。我想从tabindex / tab顺序中删除链接:

<p>
<input type="text" name="field1" id="field1" value="" />
<a href="..a url.." id="link1">more info</a>
</p>

<p>
<input type="text" name="field2" id="field2" value="" />
</p>

tab顺序是field1,link1,field2,我希望它是field1,field2,而tabindex / order中根本没有link1。除了通过 tabindex 属性重新排序之外,还有什么方法可以从 Tab 键中完全删除 link1 吗?

On an HTML form I have INPUT text box followed by a link, then followed by another INPUT text box. I want to remove the link from the tabindex / tab order:

<p>
<input type="text" name="field1" id="field1" value="" />
<a href="..a url.." id="link1">more info</a>
</p>

<p>
<input type="text" name="field2" id="field2" value="" />
</p>

The tab order is field1, link1, field2 and I want it to be field1, field2 without link1 in the tabindex / order at all. Aside from reordering via the tabindex attribute, is there any way to remove link1 from tabbing altogether?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风月客 2024-08-23 11:04:58

您可以使用 html 来实现此目的:

<p>
<input type="text" name="field1" id="field1" value="" />
<a href="#" id="link1" tabindex="-1">more info</a>
</p>

<p>
<input type="text" name="field2" id="field2" value="" />
</p>

您也可以使用 jquery 来执行此操作:

$('#link1').prop('tabIndex', -1);

You can achieve this with html:

<p>
<input type="text" name="field1" id="field1" value="" />
<a href="#" id="link1" tabindex="-1">more info</a>
</p>

<p>
<input type="text" name="field2" id="field2" value="" />
</p>

You could also use jquery to do this:

$('#link1').prop('tabIndex', -1);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文