chethu
chethu

Reputation: 374

Display error message when two ID has same value in an array using jquery

enter image description here

I have a array like this which has same tid i want to compare this array and display error message as duplicate ID is present

Upvotes: 0

Views: 491

Answers (1)

cmac
cmac

Reputation: 3268

Something like this should do it:

array.forEach(function(e,i){
  for (var j = i+1; j < array.length; j++) {
     if (e.Tid == array[j].Tid) {
        // ids match, do something
     }
   }
 });

Upvotes: 1

Related Questions