jquery如何判断表格同一列不同行input数据是否重复


复制代码 代码如下:

function hasRepeat(objId,columnIndex){
var arr = [];
$("#"+objId+" tbody tr").each(function(){
arr.push( $("td:eq("+columnIndex+")",this).text() );
});
if( arr.length==$.unique( arr ).length ){
return false;
}else{
return true;
}
}

//调用
alert( hasRepeat(tableID,列索引)==1?"有重复":"无重复" );

« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3