Home  >  Article  >  Web Front-end  >  How jquery determines whether the input data in the same column and different rows of the table is repeated_jquery

How jquery determines whether the input data in the same column and different rows of the table is repeated_jquery

WBOY
WBOYOriginal
2016-05-16 16:48:101805browse
Copy code The code is as follows:

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;
}
}

//Call
alert( hasRepeat(tableID, column index)==1?"There are duplicates":"No duplicates");
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn