【问题标题】:How to change onfocus attribute with jquery according to tabindex?如何根据tabindex用jquery更改onfocus属性?
【发布时间】:2011-03-11 12:20:59
【问题描述】:

我的页面中有一个按 tabindex 排序的元素列表。我正在寻找的是如何模拟 Tab 键被按下,以便将焦点移到下一个元素上?我计划通过使用 jquery 在特定时间间隔(即 1 秒)内改变对元素的关注。

【问题讨论】:

  • 可能类似于this

标签: javascript jquery setfocus onfocus


【解决方案1】:

试试这个:

$('a[href="#your_tab"]').trigger('click')

编辑: 我看到您正在尝试模拟TAB 按键而不是click 鼠标点击。我认为这会对你有所帮助:Simulating a tab keypress using JavaScript

【讨论】:

    【解决方案2】:

    您可以使用 Ropstah 示例,但会触发按键事件 http://api.jquery.com/trigger/。您可以指定要“按下”的键码

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-26
      • 1970-01-01
      • 2019-10-01
      • 1970-01-01
      • 2012-10-24
      • 2014-10-07
      • 2019-01-03
      • 1970-01-01
      相关资源
      最近更新 更多