Rohita Khatiwada
Rohita Khatiwada

Reputation: 2925

Prevent tab stop on url

I am navigating around controls in an application using tab. But the problem is when last element is reached, pressing tab focus on address bar. Is it possible to remove tab index from addressbar and set focus on first element.

I am looking for something like this: But I could not find the way to access url object.

urlObj.setAttribute('tabindex', -1);
txtMyBox.setAttribute('tabindex', 1);

Upvotes: 1

Views: 3448

Answers (1)

Salman
Salman

Reputation: 9447

You will have to programmatically check if the focus is on the last input box and set focus to first one using .focus()

See the fiddle here

You will just have to change this part document.body.firstElementChild with the element of your choice, or may be you could use $('input').first().focus();

Upvotes: 1

Related Questions