jQuery.inArray(value,array)方法查找 第一个参数在数组中的位置(如果没找到返回-1);
例如:
var rule =["ming"];
var test =["js","ming","li","xiaoming"];
$.inArray(rule ,test );//返回值的位置为1
if($.inArray(rule ,test )>0){
console.log("存在")
}else{
console.log("不存在")
}
jQuery.inArray(value,array)方法查找 第一个参数在数组中的位置(如果没找到返回-1);
例如:
var rule =["ming"];
var test =["js","ming","li","xiaoming"];
$.inArray(rule ,test );//返回值的位置为1
if($.inArray(rule ,test )>0){
console.log("存在")
}else{
console.log("不存在")
}