English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML tag大全

HTML tabindex attribute

tabindex global attribute indicates whether the element can be focused, and it/Where to participate in the keyboard navigation order (usually using the Tab key, hence the name).

HTML Global Attributes

Note: The maximum value of tabindex should not exceed 32767.If not specified, its default value is -1.

Online Example

Link in specified tabindex order:

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>HTML tabindex attribute usage (Basic Tutorial Website oldtoolbag.com)</title>/<title>
</<head>
<body>
<div tabindex="1">oldtoolbag.com</div><br>
<div tabindex="3">google.com</div><br>
<div tabindex="2">microsoft.com</div>
<script>
// At start, set focus on the first div
document.getElementsByTagName('div')[0].focus();
</script>
<p tabindex="4<b>Note:</b>/Try navigating the elements by using the "Tab" button on your keyboard./p>
</body>
</html>
Test see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the tabindex attribute

Definition and Usage

The tabindex attribute specifies the tab order of elements (when navigating using the 'tab' button).

HTML 4.01 with HTML5differences

In HTML5In HTML, the tabindex attribute can be used on any HTML element (it will be validated on any HTML element. However, it may not be useful).

In HTML 4.01In HTML, the tabindex attribute can be used with <a>, <area>, <button>, <input>, <object>, <select>, and <textarea>.

Syntax

        <element tabindex="number">

Attribute value

ValueDescription
numberSpecify the tab key control order for elements (1 is the first).
HTML Global Attributes