var anArray = [1,2,3,4,5]; var threeIndex = $.inArray(3, anArray); //threeIndex equals 2 var eightIndex = $.inArray(8, anArray); //eightIndex equals -1, because it isn't in the array