$.inArray(val,arr,[from])
返回值
Number
概述
确定第一个参数在数组中的位置,从0开始计数(如果没有找到则返回 -1 )。
参数
示例
描述: 查看对应元素的位置
jQuery 代码
var arr = [ 4, "Pete", 8, "John" ];
jQuery.inArray("John", arr); //3
jQuery.inArray(4, arr); //0
jQuery.inArray("David", arr); //-1
jQuery.inArray("Pete", arr, 2); //-1