Can I dynamically set tabindex in JavaScript?

Solution 1:

document.getElementById("link3").tabIndex = 6;

Solution 2:

Using JQuery we can set tab index dynamically easily Try this code- set the tabindex and increment the variable

$(function() {
    var tabindex = 1;
    $('input,select').each(function() {
        if (this.type != "hidden") {
            var $input = $(this);
            $input.attr("tabindex", tabindex);
            tabindex++;
        }
    });
});