Edit This Code:
<!DOCTYPE html>
<html>
<body>

<a href="../index.html" tabindex="2">W3Schools</a><br>
<a href="http://www.google.com/" tabindex="1">Google</a><br>
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>

<p>Click the button to get the tab order of the first link (index 0) in the
document.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementsByTagName("A")[0].tabIndex;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy