title: Check duplicates in html table based on first two column values
body: <p>I have a requirement where i need to check for duplicate data in html table. I have two columns product name and batch. As per the requirement product name can be repeated,but if same batch repeats for same product name,i need to show an alert with corresponding batch and product name in the alert. I heve created a snippet below which represents the issue more appropriately. </p>
  
  <p>Below table contains two rows with same product name and batch for which i want to show an alert.</p>
  
  <p>Please help me! </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function highlightDuplicates() {
   
   
        a1 =0;
        a2 =0;
        
        $('#myTable .tbody tr').find('input').each(function() {
         // check if there is another one with the same value
           if ($('#myTable td:nth-child(1)').find('input[value="' + $(this).val() + '"]').size() &gt; 1 &amp;&amp; $('#myTable td:nth-child(2)').find('input[value="' + $(this).val() + '"]').size() &gt; 1) {
               
           alert("Duplicate found")
                     return false; 
                
            } 
        });
        }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>table {
      border-collapse: collapse;
      width: 100%;
      
      }
  th {
      background-color: #009999;
      color: black;
     
  }
  th,td{
      padding:0.8em;
      border: 1px solid;
  }
  th{
      background-color:#6699FF;
      font-weight:bold;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;table id="myTable"&gt;
      &lt;thead&gt;
      &lt;tr&gt;
      &lt;th&gt;Product Name&lt;/th&gt;
      &lt;th&gt;Batch&lt;/th&gt;
      &lt;tr&gt;
      &lt;/thead&gt;
      &lt;tbody class="tbody"&gt;
      &lt;tr&gt;
      &lt;td&gt;&lt;input type="text" value="a"&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="text" value="b"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;&lt;input type="text" value="c"&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="text" value="d"&gt;&lt;/td&gt;
      &lt;/tr&gt;
     &lt;tr&gt;
      &lt;td&gt;&lt;input type="text" value="a"&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="text" value="b"&gt;&lt;/td&gt;
      &lt;/tr&gt; 
      &lt;/tbody&gt;
     &lt;/table&gt; 
  
     &lt;br&gt;
     &lt;button onclick="return highlightDuplicates()"&gt;Check Duplicates&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>