Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to calculate element created by append?
    primarykey
    data
    text
    <p>I want to calculate summary of price*quantity how to do that?</p> <p>Table 1 :click add for create detail in table2</p> <pre><code>&lt;table width="60%" border="1"&gt; &lt;tr&gt; &lt;td align="center"&gt;menu&lt;/td&gt; &lt;td align="center"&gt;quantity&lt;/td&gt; &lt;td align="center"&gt;price&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr id="workplace-view-menu"&gt; &lt;td id="workplace-menu"&gt;coffee&lt;/td&gt; &lt;td id="workplace-number"&gt;5&lt;/td&gt; &lt;td id="workplace-price"&gt;50&lt;/td&gt; &lt;td align="center"&gt;&lt;input type="button" value="add" id="workplace-submit" name="workplace-submit" class="btn-green"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr id="workplace-view-menu"&gt; &lt;td id="workplace-menu"&gt;food&lt;/td&gt; &lt;td id="workplace-number"&gt;2&lt;/td&gt; &lt;td id="workplace-price"&gt;70&lt;/td&gt; &lt;td align="center"&gt;&lt;input type="button" value="add" id="workplace-submit" name="workplace-submit" class="btn-green"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Table 2 : created element by jquery and calculate value in td class='ordernumber' * td class='order-price'</p> <pre><code>&lt;table width="200" border="1" id="order-detial"&gt; &lt;tr&gt; &lt;td&gt;menu&lt;/td&gt; &lt;td&gt;quantity&lt;/td&gt; &lt;td&gt;price&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div id="calculator"&gt;&lt;/div&gt; </code></pre> <p>Jquery :</p> <pre><code>$(document).ready(function(){ $('#workplace-submit').click(function(){ var menu=$('#workplace-menu-name').val(); var number=$('#workplace-number').val(); var price=$('td#workplace-price').text(); $('#order-detial').append('&lt;tr class="order-detials"&gt;&lt;td&gt;'+menu+'&lt;/td&gt;&lt;td class="order-number"&gt;'+number+'&lt;/td&gt;&lt;td class="order-price"&gt;'+price+'&lt;/td&gt;&lt;td&gt;&lt;button class="btn-green" onclick="OrderRemove(this)"&gt;delete&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt;'); OrderRemove = function(el) { $(el).parents("tr").remove(); } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload