jQuery.inArray( value, array [, fromIndex ] )Возвращает: Number

Описание: Ищет заданный элемент в массиве. Возвращает индекс этого элемента или -1 в случае его отсутствия.

The $.inArray() method is similar to JavaScript's native .indexOf() method in that it returns -1 when it doesn't find a match. If the first element within the array matches value, $.inArray() returns 0.

Because JavaScript treats 0 as loosely equal to false (i.e. 0 == false, but 0 !== false), to check for the presence of value within array, you need to check if it's not equal to (or greater than) -1.

The comparison between values is strict. The following will return -1 (not found) because a number is being searched in an array of strings:

$.inArray( 5 + 5, [ "8", "9", "10", 10 + "" ] );

Примеры использования