Find Max tabindex inside form

Using jQuery / Javascript, how do I find the maximum value tabindex

that exists on a given form #formID

?

And before you ask (because I know people), I haven't tried anything because I really don't know where to start.

+3


source to share


1 answer


This is one way:

var max = -1;
$('#formID [tabindex]').attr('tabindex', function (a, b) {
    max = Math.max(max, +b);
});

      



max = -1

indicates that there are no tabindexes in the form, or that elements are excluded from the tab order.

Live demo at jsFiddle .

+8


source







All Articles