Reputation: 4606
I am trying to focus on an anchor in jquery
i am using these codes:
$(textBox).parent().next().find('a').first().focus();
or
$(textBox).parent().next().find('a')[0].focus();
but these codes does not work
while
$(textBox).parent().next().find('a').first()
returns:
<a role="menuitem" class=""><strong>101</strong>0320117585</a>
Upvotes: 4
Views: 500
Reputation: 69
Two things you should a ID on that anchor and also a tab-index, and as prefer a negative value, and it will not in IE even the 8:
<a href="someWhere" id="someName" tabindex=-1>Click Me!<a/>
Upvotes: 1
Reputation: 4051
It seems that your anchor needs to have a href
attribute (at least in Chrome).
If you don't need a special href
you can use href="javascript:void(0);"
Upvotes: 2