2018-10-12 15:37:13 -04:00
|
|
|
---
|
|
|
|
title: Use tabindex to Specify the Order of Keyboard Focus for Several Elements
|
|
|
|
---
|
2019-07-24 00:59:27 -07:00
|
|
|
# Use tabindex to Specify the Order of Keyboard Focus for Several Elements
|
|
|
|
|
|
|
|
<details><summary>Solution 1 (Click to Show/Hide)</summary>
|
2018-10-12 15:37:13 -04:00
|
|
|
|
|
|
|
Following the instructions:
|
|
|
|
|
|
|
|
Add a tabindex attribute set to "1" to the search input, and a tabindex attribute set to "2" to the submit input.
|
|
|
|
|
|
|
|
the lines 16 and 17
|
2019-07-24 00:59:27 -07:00
|
|
|
```css
|
2018-10-12 15:37:13 -04:00
|
|
|
<input tabindex="1" type="search" name="search" id="search">
|
|
|
|
<input tabindex="2" type="submit" name="submit" value="Submit" id="submit">
|
|
|
|
```
|
|
|
|
|
|
|
|
become:
|
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
```css
|
2018-10-12 15:37:13 -04:00
|
|
|
<input type="search" name="search" id="search">
|
|
|
|
<input type="submit" name="submit" value="Submit" id="submit">
|
|
|
|
```
|
|
|
|
|
|
|
|
In this way the search input and submit input form controls to be the first two items in the tab order.
|
2019-07-24 00:59:27 -07:00
|
|
|
|
|
|
|
</details>
|