Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <button> tabindex Attribute

The tabindex attribute on a <button> tag specifies the keyboard tab order of the button relative to the other controls on the page.

The tabindex value indicates when the button can be focused.

Example

#

Three buttons with tabindex values of 1, 2, and 3 respectively. Place the focus on Button 1 and then tab a couple times. Focused elements have a  gold  background.



<button tabindex="1">Button 1</button><br />
<button tabindex="2">Button 2</button><br />
<button tabindex="3">Button 3</button>

Code explanation

The tabindex attribute assigns a tab sequence number to an button.

The actual tabindex numbers are not important. So, 10, 22, and 36 would give the same results.


Using tabindex

The tabindex specifies the focus order of the <button> relative to the other buttons or controls on the page.

This attribute indicates the sequential order of elements using the tab key.

With a negative tabindex value, the button is not reachable by tabbing but can be accessed by mouse or JavaScript.

The tabindex attribute is a global attribute that can be applies to any element.


Syntax

<a tabindex="index">

Values

#

Value Description
index Numeric value indicating the tab order relative to the other controls.

Browser support

Here is when tabindex support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <button>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides