[英]Advice about using Tabindex and javascript/jquery to make “tabbing” easier
I'm making a large and complex application and I need to set tabindexes to help user navigate through the pages. 我正在制作一个大型而复杂的应用程序,我需要设置tabindexes来帮助用户浏览页面。 This is a private application so I don't have restriction about (ab)using javascript (jquery). 这是一个私人应用程序,因此我对(ab)使用javascript(jquery)没有任何限制。
I currently have these questions. 我目前有这些问题。
1) How do you force with javascript (jquery) the browser to move the cursor inside a specific textbox as soon as a page has loaded? 1)如何在页面加载后立即使用javascript(jquery)强制浏览器在特定文本框中移动光标? I noticed that often browsers don't automatically put the cursor inside the first tabindexed input. 我注意到,通常浏览器不会自动将光标置于第一个使用索引索引的输入中。 I want a surefire way that forces it there no matter what. 我想要一种无论如何都将其强制执行的安全射击方法。
2) Some fields that activate ui enanchement (namely jquery ui datepicker) have problems with tabbing (like having to push tab two time to go away from it), is there any way to avoid this? 2)一些激活ui启用的字段(即jquery ui datepicker)在制表时遇到问题(例如必须两次按制表键才能离开它),有什么办法可以避免这种情况?
3) How do you read and set tabindex with jquery? 3)如何使用jquery读取和设置tabindex? I have some fields that get hidden/shown based on user action and they should be able to "give" their tabindex to other fields if they get hidden, is this a problem, does the browser still consider a tabindex after the page has loaded? 我有一些根据用户操作隐藏/显示的字段,如果它们被隐藏,它们应该能够将其tabindex赋予其他字段,这是一个问题,浏览器在页面加载后仍会考虑tabindex吗?
Thank you very muchh 非常感谢你
$('#firstBox').focus();
要将焦点放在特定的文本框上,请执行以下操作(假设文本框ID为#firstBox): $('#firstBox').focus();
See more examples here: How do you automatically set the focus... 在此处查看更多示例: 如何自动设置焦点...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.