W3cubDocs

/jQuery UI

:tabbable Selector

tabbable selector

Description: Selects elements which the user can focus via tabbing.

  • jQuery( ":tabbable" )

Some elements are natively tabbable, while others require explicitly setting a positive tab index. In all cases, the element must be visible in order to be tabbable.

Elements of the following type are tabbable if they do not have a negative tab index and are not disabled: input, select, textarea, button, and object. Anchors are focusable if they have an href or positive tabindex attribute. area elements are focusable if they are inside a named map, have an href attribute, and there is a visible image using the map. All other elements are tabbable based solely on their tabindex attribute and visibility.

Note: Elements with a negative tab index are :focusable, but not :tabbable.

Example:

Select tabbable elements and highlight them with a red border.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>tabbable demo</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
  <style>
  input {
    border: 1px solid #000;
  }
  div {
    padding: 5px;
  }
  </style>
  <script src="//code.jquery.com/jquery-1.12.4.js"></script>
  <script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
<body>
 
<div><input value="no tabindex"></div>
<div><input tabindex="5" value="positive tabindex"></div>
<div><input tabindex="-1" value="negative tabindex"></div>
 
<script>
$( ":tabbable" ).css( "border-color", "red" );
</script>
 
</body>
</html>

Demo:

© The jQuery Foundation and other contributors
Licensed under the MIT License.
https://api.jqueryui.com/tabbable-selector