如何使用jquery在li页面加载上设置标签焦点 [英] how to set tab focus on li page load using jquery

查看:264
本文介绍了如何使用jquery在li页面加载上设置标签焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在html中有以下代码.

I have below code in html.

<li class="selected" runat="server" id="lihome"><a href="/ISS/home.aspx" title="Home"><span>Home</span></a></li>

现在,我想在页面加载时从此li开始制表.请建议如何做.

Now I want to start my tabbing from this li when my page get loaded. Please suggest how to do this.

谢谢.

最好的问候,

MS

推荐答案

您应该将锚点元素集中在选定的" LI内,因为只有表单元素,锚点和iframe是 focusable :

You should focus the anchor element inside the "selected" LI, since only form elements, anchors and iframes are focusable:

$(function () { 
  $('li.selected a').focus(); 
});

这篇关于如何使用jquery在li页面加载上设置标签焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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