如何更改 jQuery UI 滑块句柄上的 tabindex?

发布于 2024-10-11 04:09:21 字数 438 浏览 9 评论 0原文

我有一个滑块,需要将其 tabindex 更改为 -1。我知道这是一个巨大的“不不”,但开发的网站对于使用屏幕阅读器等的任何人来说已经毫无用处。

问题是我有一个链接,单击该链接会打开一个彩色框。在该颜色框内是一个表格,在尾部滑块上分为“幻灯片”。我已将表单元素全部设置为 -1 选项卡索引,但其中一个表单问题具有 Jquery UI 滑块元素,以允许用户设置其高度。

该元素本身是一个带有类的锚标记:“ui-slider-handle”,但它是在页面加载后创建的,所以我不能只执行简单的 jQuery。我尝试使用 .live 函数,但它需要一个事件类型。我不希望它基于创建时以外的事件。除非您认为 Keydown 的主要目标是阻止用户按 Tab 并移动滑块,否则表单包含在其中,而不使用滑块的下一个和上一个导航。

我知道这令人困惑,为什么有人会建立这样的网站,但那是在我进入图片之前。任何帮助将不胜感激!提前致谢!

I have a slider that I need to change the tabindex to -1 on. I know this is a huge 'no no' but the site that is developed is already useless to anyone using a screen reader etc.

The issue is I have a link that when clicked opens a color box. Inside that color box is a form separated into 'slides' on a coda slider. The forms elements I have all set to a -1 tab index but one of the form questions has a Jquery UI slider element to allow the person set their height.

The element itself is an anchor tag with the class: "ui-slider-handle" but it's created after the page load so I can't just do simple jQuery. I tried using the .live function but it wants an eventtype. I don't want it to be based on an event other than just when it's created. Unless you think Keydown would work as the main objective is to stop users from pressing tab and moving the slider the form is contained within without using the slider's navigation of next and previous.

I understand this is confusing as to why someone would set a site up like this but it was before I entered the picture. Any help would be greatly appreciated! Thanks in advance!

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

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

发布评论

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

评论(1

画▽骨i 2024-10-18 04:09:21

你说它是“页面加载后创建的”。什么引擎正在创建该元素?您应该能够执行 Javascript 代码,或者至少在创建元素后立即调用 Javascript 函数,在此期间您可以将属性添加到具有该类的所有元素:

$('.ui-slider-handle').attr('tabindex', '-1');

You say it's "created after page load." What engine is creating the element? You should be able to execute Javascript code, or at least call a Javascript function immediately after the element creation, during which you could add the attribute to all elements with that class:

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