/

HTML / CSS / JavaScript Tutorial

JavaScript DOM HTML property: tabIndex

[this page | pdf | back links]

The tabIndex property of HTML elements within the JavaScript DOM sets / returns the tabindex attribute of the element.

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Step through the entries using the TAB key (before and after clicking button)<br><br>

<a id="x1" href="http://www.nematrian.com/Introduction.aspx">Website Introduction</a><br>
<a id="x2" href="http://www.nematrian.com/HTMLCSSJSTutorial.aspx">HTML/CSS/JavaScript Tutorial</a><br><br>
<input type="button" onclick="change()" value="Change tabIndex">

<script>
function change() {
  document.getElementById("x1").tabIndex = "2";
  document.getElementById("x2").tabIndex = "1";
}
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile