Calculate each table row values using jquery automatically
<p>I have this data in my table</p>

<p>cost &nbsp;&nbsp;  postage &nbsp;&nbsp; profit &nbsp;&nbsp;  paypal &nbsp;&nbsp;  selling price<br />
 2.75 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>16.75</strong> <br />
 5.75 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>19.75</strong> <br />
 3.99 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>17.99</strong>
<br /></p>

<p>The value in the <strong>cost</strong> table is being fetch from the <strong>database</strong> and the values in the <strong>postage</strong>, <strong>profit</strong>, and <strong>paypal</strong> are both constant. When i update the <strong>cost</strong> value in the database it will now display in the table and do automatic calculation based on what value i updated and display the answer in the <strong>selling_price</strong> column. I am a bit confused on how to implement client-side calculation in jQuery. Could anyone help me solve this one. Any help will be much more appreciated. </p>

<p>Here is the code that i created</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
    &lt;script language="javascript" src="jquery.js"&gt;&lt;/script&gt; 

    &lt;script&gt; 
        $(document).ready(function() {
            //iterate through each textboxes and add keyup handler to trigger sum event
            $(".txt").each(function() 
            {
                $(this).keyup(function() {
                    calculateSellingPrice();
                });
            });
        });

        function calculateSellingPrice() {
            var sellingprice = 0;
            //iterate through each textboxes and add the values
            $(".txt").each(function() {
                //add only if the value is number
                if (!isNaN(this.value) &amp;&amp; this.value.length != 0) {
                    sellingprice += parseFloat(this.value);
                    $(this).css("background-color", "#FEFFB0");
                }
                else if (this.value.length != 0){
                $(this).css("background-color", "red");
               }
            });
            $("#sellingprice").html(sellingprice.toFixed(2));
        }
    &lt;/script&gt;   
&lt;/head&gt;
&lt;body&gt;  

        &lt;table border = "0"&gt;    
            &lt;tr bgcolor="#cccccc"&gt;
                &lt;td&gt;&lt;center&gt;Selling Price&lt;/center&gt;&lt;/td&gt;
                &lt;td&gt;&lt;center&gt;Cost&lt;/center&gt;&lt;/td&gt;
                &lt;td&gt;&lt;center&gt;Postage&lt;/center&gt;&lt;/td&gt;
                &lt;td&gt;&lt;center&gt;Profit&lt;/center&gt;&lt;/td&gt;
                &lt;td&gt;&lt;center&gt;Paypal&lt;/center&gt;&lt;/td&gt;
            &lt;/tr&gt; 

            &lt;?php

            $result = mysql_query("SELECT cost FROM table");
            while ($myrow = mysql_fetch_row($result))
            {
            ?&gt;
                &lt;tr&gt;
                    &lt;td&gt;
                        &lt;?php echo "&lt;input type='text' id='sellingprice' name='sellingprice' size='10' /&gt;"; ?&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &lt;?php echo "&lt;input class='txt' type='text' id='cost' name='cost' size='10' value='$myrow[1]' /&gt;"; ?&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &lt;?php echo "&lt;input class='txt' type='text' id='postage' name='postage' size='10' value='3' /&gt;"; ?&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &lt;?php echo "&lt;input class='txt' type='text' id='profit' name='profit' size='10' value='6' /&gt;"; ?&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &lt;?php echo "&lt;input class='txt' type='text' id='paypal' name='paypal' size='10' value='5' /&gt;"; ?&gt;
                    &lt;/td&gt;
                &lt;/tr&gt;   
                &lt;?php
            }
                ?&gt;
        &lt;/table&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>i just found the jquery code in the internet although i understand a bit about the jquery code but i'm stock and can't continue. </p>
