Don't Append if the same in jquery
<p>table1 has contents ( items ) while table 2 has nothing ( because it is the shopping cart ) now what i want to do is to check if the user is adding the same item on the shopping cart and if he/she does it will add the qty and doesn't write another tr. How can i do this?</p>

<pre><code>#table 1
&lt;table&gt;
  &lt;tr&gt;&lt;td&gt;Item001&lt;/td&gt;&lt;td&gt;5.00&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Item002&lt;/td&gt;&lt;td&gt;5.00&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

#table 2 //it is blank because it will be filled later via onclick from table1
&lt;table&gt;
&lt;/table&gt;
</code></pre>

<p>if the user clicked item001 it will be appended to table2 now if the user selects item001 again it must not write item001 again on table2 but will only append the quantity.</p>

<h2>UPDATE</h2>

<pre><code>var itemDesc = $(this).find('.desc').text();
var getPrice = $(this).find('.price').text();
var itemName = $(this).find('.itemName').text();
var currentId = $('#cartGrid tr').attr('id');

if(itemName == currentId)
{ 
    qty +=1;
    $('.tableQty').html(qty);
    qty = 1;
}
else{
    $('#cartGrid').append("&lt;tr id="+ itemName +"&gt;&lt;td&gt;" + itemDesc + "&lt;/td&gt;&lt;td class='tableQty'&gt;"+ qty +"&lt;/td&gt;&lt;td class='tablePrice'&gt; $" + getPrice +"&lt;/td&gt;&lt;/tr&gt;");

}
</code></pre>

<p>Now i got it to work. But only on the first item. Help? THank you</p>
