I cannot figure out why I keep getting -1 for lastProductIndex when clearly the lastProductID is in the array!
var lastProductID = 6758;
var allProductIDs =
I had the same problem yesterday,,
var data=[2,4,6,8];
alert( $.inArray(4,data) ) // output 1 as expected
alert( $.inArray("4",data) ) // output -1 as expected
Generally this occurs when you get the value to check from a input element or something that returns a string. You need to do parseInt(string,radix) to convert it to a number...