I have a bunch of <input>
s that I have in a certain tab sequence. The last tab is a <a>
that when clicked on adds another <input>
to the list. Is there a way to use javascript or just plain HTML to make it so that when the user tabs to that link it executes the link?
I have a bunch of <input>
s that I have in a certain tab sequence. The last tab is a <a>
that when clicked on adds another <input>
to the list. Is there a way to use javascript or just plain HTML to make it so that when the user tabs to that link it executes the link?
-
3
Doesn't the
a
element receive focus when you tab to it? If so you can just execute some javascript inonfocus
. – Klaus Byskov Pedersen Commented Nov 13, 2010 at 21:07 - @Klaus, didn't think about that option. I will try that out. thanks. – chromedude Commented Nov 13, 2010 at 21:08
- @Klaus You should have posted it as an answer :) – Draco Ater Commented Nov 13, 2010 at 21:09
- If the A only adds the INPUT on CLICK, it should only add the INPUT on ENTER. If you want it to add the INPUT on TAB, it should also add the INPUT on hover. Else your mouse-keyboard navigation shows different behaviour. – Konerak Commented Nov 13, 2010 at 21:10
2 Answers
Reset to default 5Doesn't the a
element receive focus when you tab to it? If so you can just execute some javascript in onfocus
Yes,
You can use the anchor onfocus event. See:
<a href="#123" onfocus="Test(this);">Test</a>
And the function "Test" must read the "href" attribute, something like:
function Test(target)
{
location.href = target.getAttribute('href');
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745559506a4633020.html
评论列表(0条)