如何更改 jQuery UI 的滑块句柄上的 tabindex? [英] How can you change the tabindex on a jQuery UI's slider Handle?

查看:38
本文介绍了如何更改 jQuery UI 的滑块句柄上的 tabindex?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

问题是我有一个链接,单击该链接会打开一个颜色框.在该颜色框内是一个表格,在结尾滑块上分为幻灯片".我已将表单元素全部设置为 -1 选项卡索引,但其中一个表单问题有一个 Jquery UI 滑块元素,允许人们设置他们的高度.

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.

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

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!

推荐答案

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

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');

这篇关于如何更改 jQuery UI 的滑块句柄上的 tabindex?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆