0

I'm making a large and complex application and I need to set tabindexes to help user navigate through the pages. This is a private application so I don't have restriction about (ab)using 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? 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?

3) How do you read and set tabindex with jquery? 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?

Thank you very muchh

4

1 回答 1

2
  1. 要将焦点放在特定的文本框上,请执行以下操作(假设文本框 id 是#firstBox):$('#firstBox').focus();在此处查看更多示例:如何自动设置焦点...
  2. 不是特别是因为 DatePicker 也是它自己的 UI,所以它里面有各种可以关注的对象(这就是 tabbing 的作用)。
  3. 实际上,现在我已经考虑过了,如果您隐藏一个字段(AKA,“隐藏”),它将没有 tabindex 并且其他选项卡将符合为浏览器定义的内容(通常是从上到下,从左到右的顺序)。您不必担心手动设置 tabindex。
于 2010-09-29T15:34:39.140 回答