Element tabIndex Property - Get the tab order of the first <a> element (index 0) in the document: - Javascript DOM

Javascript examples for DOM:Element tabIndex

Description

Element tabIndex Property - Get the tab order of the first <a> element (index 0) in the document:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {//  w  ww.j a  v  a 2s.c  o  m
    var x = document.getElementsByTagName("A")[0].tabIndex;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials