How does jquery determine if input data is duplicated in different rows in the same table column

  • 2020-03-30 03:00:52
  • OfStack

 
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, The column index )==1?" There are repeated ":" No repeat " ); 

Related articles: