<!DOCTYPE html>
<html lang="en-US">
<body>
<p>Press 'Tab' key to navigate through input.</p>
<p>Name</p>
<input type="text" value="John" tabindex="3">
<p>Age</p>
<input type="text" value="45" tabindex="1" autofocus>
<p>Gender</p>
<input type="text" value="Male" tabindex="2">
<p>Click on the button to get the tabIndex value of input 3 (Gender).</p>
<button onclick="myFunction()">Click Me</button>
<p id="point"></p>
<script>
var x = document.getElementById("point");
var elem = document.getElementsByTagName("input")[0];
function myFunction(){
x.innerHTML = "tabIndex = " +elem.tabIndex;
}
</script> </body>
</html>