开发者

how to make html anchor accessible in asp.net mvc web application?

开发者 https://www.devze.com 2023-03-16 03:41 出处:网络
If i use a anchor tag in my asp.net mvc 2 web app how can i make sure the user can \'tab\' to it in case he is just using his keyboard?

If i use a anchor tag in my asp.net mvc 2 web app how can i make sure the user can 'tab' to it in case he is just using his keyboard?

I use something like this but it is not accessible?

 <a id="someanchor">Upload statement</a>

   $(开发者_如何学编程"#someanchor").click(function () {
            //some js
        });

how to create an anchor tag that is accesible?


You need an href - without one, the anchor is considered to be a non-interactive placeholder.

<a id="someanchor" href="javascript:void(0)">Upload statement</a>

In this case, the href is present, so the A ends up being a tabbable link and can be activated via keyboard, but the target URL - javascript:void(0) - is basically a no-op, so no actual navigation occurs.

0

精彩评论

暂无评论...
验证码 换一张
取 消