我最近得出结论,$ .inArray不起作用。 我到处研究,看到类似的线程jQuery: why doesn't jQuery.inArray() work?
但我仍然认为它是一个jQuery错误。 因为我有我正在使用$ .inArray
这里是的console.log
VAR testArray值是一个数组:
["1", "15"]
这是obvisouly在JavaScript中的数组。
,我使用命令
if($.inArray(14, testArray))
alert("14 should not be in array. Isn't it?");
我也试过以下,但史迪威同样的问题:
if(jQuery.inArray('14', testArray))
alert("14 should not be in array. Isn't it?");
你忘了问一个问题.. ! –
我已更新相同。 :) – Thompson