title: Merge equal table cells with jQuery
body: <p>Simple html table with NxM values. 
  The aim is to merge equal cells in column with jQuery.
  Note, that in one row there are no duplicates.</p>
  
  <p>I got how to hide the equal cells, but is there any way to combine a cell with data with an empty cell in one?</p>
  
  <p>html:</p>
  
  <pre><code>&lt;table border="1" id="testTable"&gt;
  &lt;tr&gt;
      &lt;td&gt;First&lt;/td&gt;
      &lt;td&gt;A&lt;/td&gt;
      &lt;td&gt;A&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;First&lt;/td&gt;
      &lt;td&gt;A&lt;/td&gt;
      &lt;td&gt;B&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;Second&lt;/td&gt;
      &lt;td&gt;V&lt;/td&gt;
      &lt;td&gt;S&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;Third&lt;/td&gt;
      &lt;td&gt;D&lt;/td&gt;
      &lt;td&gt;H&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;Third&lt;/td&gt;
      &lt;td&gt;E&lt;/td&gt;
      &lt;td&gt;E&lt;/td&gt;       
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>js:</p>
  
  <pre><code>var seenArray = {};
  $('#testTable td').each(function() 
  {
      var index =  $(this).index();
      var txt = $(this).text();
      if (seenArray[index] === txt) 
      {
          $(this).text(''); //I think here should be "marging"
      }
      else 
      {
          seenArray[index] = txt;
      }
  });
  </code></pre>
  
  <p><a href="http://jsfiddle.net/Braves/djhU7/" rel="nofollow noreferrer">jsFiddle</a></p>
  
  <p><strong>P.S.</strong> One more thing, the data originally is retrieved in json array, then I do <code>.parseJSON()</code> first and put data in table using:</p>
  
  <pre><code>for (var i = 0; i &lt; obj.length; i++) 
  {
      tr = $('&lt;tr/&gt;');
      tr.append("&lt;td&gt;" + obj[i]['columnA'] + "&lt;/td&gt;");
      tr.append("&lt;td&gt;" + obj[i]['columnB'] + "&lt;/td&gt;");
      tr.append("&lt;td&gt;" + obj[i]['columnC'] + "&lt;/td&gt;");
      $('#testTable').append(tr); 
  }
  </code></pre>
  
  <p><strong>UPD</strong></p>
  
  <p><a href="https://stackoverflow.com/users/774086/alfred-nsh">alFReD NSH</a> made a good solution for 2 cells. <a href="http://jsfiddle.net/djhU7/4/" rel="nofollow noreferrer">Here</a> is his solution.
  But, if there will be more than 2 equal cells.</p>