<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" > <channel><title>Comments on: Sum HTML Textbox Values using jQuery / JavaScript</title> <atom:link href="http://viralpatel.net/blogs/2009/07/sum-html-textbox-values-using-jquery-javascript.html/feed" rel="self" type="application/rss+xml" /><link>http://viralpatel.net/blogs/2009/07/sum-html-textbox-values-using-jquery-javascript.html</link> <description>Tutorials, Java, J2EE, Struts, AJAX, JavaScript, CSS, Web 2.0, MySQL, Articles</description> <lastBuildDate>Wed, 08 Feb 2012 10:36:26 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Dilip</title><link>http://viralpatel.net/blogs/2009/07/sum-html-textbox-values-using-jquery-javascript.html/comment-page-1#comment-25765</link> <dc:creator>Dilip</dc:creator> <pubDate>Wed, 01 Feb 2012 09:35:35 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=1583#comment-25765</guid> <description>thanks a lot</description> <content:encoded><![CDATA[<p>thanks a lot</p> ]]></content:encoded> </item> <item><title>By: Mohammed Sabbir</title><link>http://viralpatel.net/blogs/2009/07/sum-html-textbox-values-using-jquery-javascript.html/comment-page-1#comment-25759</link> <dc:creator>Mohammed Sabbir</dc:creator> <pubDate>Wed, 01 Feb 2012 04:17:34 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=1583#comment-25759</guid> <description>ok. i fix it.thnx</description> <content:encoded><![CDATA[<p>ok. i fix it.thnx</p> ]]></content:encoded> </item> <item><title>By: Mohammed Sabbir</title><link>http://viralpatel.net/blogs/2009/07/sum-html-textbox-values-using-jquery-javascript.html/comment-page-1#comment-25758</link> <dc:creator>Mohammed Sabbir</dc:creator> <pubDate>Wed, 01 Feb 2012 04:12:45 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=1583#comment-25758</guid> <description>this is for .html(sum.toFixed(2)); but i want to put addition data to another textbox.when i do so using .val to going mad on me.how can i fix it.</description> <content:encoded><![CDATA[<p>this is for .html(sum.toFixed(2)); but i want to put addition data to another textbox.when i do so using .val to going mad on me.how can i fix it.</p> ]]></content:encoded> </item> <item><title>By: Mohammed Sabbir</title><link>http://viralpatel.net/blogs/2009/07/sum-html-textbox-values-using-jquery-javascript.html/comment-page-1#comment-25757</link> <dc:creator>Mohammed Sabbir</dc:creator> <pubDate>Wed, 01 Feb 2012 03:56:23 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=1583#comment-25757</guid> <description>Thanks a lot for your help.</description> <content:encoded><![CDATA[<p>Thanks a lot for your help.</p> ]]></content:encoded> </item> <item><title>By: Viral Patel</title><link>http://viralpatel.net/blogs/2009/07/sum-html-textbox-values-using-jquery-javascript.html/comment-page-1#comment-25699</link> <dc:creator>Viral Patel</dc:creator> <pubDate>Sun, 29 Jan 2012 16:39:57 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=1583#comment-25699</guid> <description>Hi Dilip, You using two definitions of &lt;code&gt;calculateSum()&lt;/code&gt; method. In this scenario, you can create two methods &lt;code&gt;calculateSum1()&lt;/code&gt; and &lt;code&gt;calculateSum2()&lt;/code&gt; method to tackle &lt;code&gt;.txt&lt;/code&gt; and &lt;code&gt;.txtt&lt;/code&gt; textboxes.</description> <content:encoded><![CDATA[<p>Hi Dilip, You using two definitions of <code>calculateSum()</code> method. In this scenario, you can create two methods <code>calculateSum1()</code> and <code>calculateSum2()</code> method to tackle <code>.txt</code> and <code>.txtt</code> textboxes.</p> ]]></content:encoded> </item> <item><title>By: Dilip</title><link>http://viralpatel.net/blogs/2009/07/sum-html-textbox-values-using-jquery-javascript.html/comment-page-1#comment-25681</link> <dc:creator>Dilip</dc:creator> <pubDate>Sun, 29 Jan 2012 09:24:34 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=1583#comment-25681</guid> <description>Hi Great script however how can i use two or more versions of the script on the same page. I tried the below code but doesn&#039;t work can you please tell me how can i use more than two versions on same page by changing class and id&#039;s on my input boxes and the code [code language=&quot;js&quot;] var $ = jQuery.noConflict(); $(document).ready(function(){ //iterate through each textboxes and add keyup //handler to trigger sum event $(&quot;.txt&quot;) .each(function() { $(this).keyup(function(){ calculateSum(); }); }); }); function calculateSum() { var sum = 0; //iterate through each textboxes and add the values $(&quot;.txt&quot;).each(function() { //add only if the value is number if(!isNaN(this.value) &amp;&amp; this.value.length!=0) { sum += parseFloat(this.value); } }); //.toFixed() method will roundoff the final sum to 2 decimal places $(&quot;.sum&quot;).html(sum.toFixed(2)); }var $j = jQuery.noConflict();$j(document).ready(function(){ //iterate through each textboxes and add keyup //handler to trigger sum event $j(&quot;.txtt&quot;) .each(function() { $j(this).keyup(function(){ calculateSum(); }); }); }); function calculateSum() { var sum = 0; //iterate through each textboxes and add the values $j(&quot;.txtt&quot;).each(function() { //add only if the value is number if(!isNaN(this.value) &amp;&amp; this.value.length!=0) { sum += parseFloat(this.value); } }); //.toFixed() method will roundoff the final sum to 2 decimal places $j(&quot;.teamb&quot;).html(sum.toFixed(2)); } [/code]</description> <content:encoded><![CDATA[<p>Hi Great script however how can i use two or more versions of the script on the same page. I tried the below code but doesn&#8217;t work can you please tell me how can i use more than two versions on same page by changing class and id&#8217;s on my input boxes and the code</p><pre class="brush: jscript; title: ; notranslate">
var $ = jQuery.noConflict();
    $(document).ready(function(){

        //iterate through each textboxes and add keyup
        //handler to trigger sum event
        $(&quot;.txt&quot;) .each(function()
		  {

            $(this).keyup(function(){
                calculateSum();
            });
        });

    });

    function calculateSum() {

        var sum = 0;
        //iterate through each textboxes and add the values
        $(&quot;.txt&quot;).each(function() {

            //add only if the value is number
            if(!isNaN(this.value) &amp;amp;&amp;amp; this.value.length!=0) {
                sum += parseFloat(this.value);
            }

        });
        //.toFixed() method will roundoff the final sum to 2 decimal places
        $(&quot;.sum&quot;).html(sum.toFixed(2));
    }

var $j = jQuery.noConflict();

    $j(document).ready(function(){

        //iterate through each textboxes and add keyup
        //handler to trigger sum event
        $j(&quot;.txtt&quot;) .each(function()
		  {

            $j(this).keyup(function(){
                calculateSum();
            });
        });

    });

    function calculateSum() {

        var sum = 0;
        //iterate through each textboxes and add the values
        $j(&quot;.txtt&quot;).each(function() {

            //add only if the value is number
            if(!isNaN(this.value) &amp;amp;&amp;amp; this.value.length!=0) {
                sum += parseFloat(this.value);
            }

        });
        //.toFixed() method will roundoff the final sum to 2 decimal places
        $j(&quot;.teamb&quot;).html(sum.toFixed(2));
    }
</pre>]]></content:encoded> </item> <item><title>By: Bobi</title><link>http://viralpatel.net/blogs/2009/07/sum-html-textbox-values-using-jquery-javascript.html/comment-page-1#comment-24277</link> <dc:creator>Bobi</dc:creator> <pubDate>Fri, 13 Jan 2012 13:15:41 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=1583#comment-24277</guid> <description>Hi, I&#039;m want to add in textbox  values from mysql and get total sum, but in text filed not load data from $var ? Help please. Thanks</description> <content:encoded><![CDATA[<p>Hi, I&#8217;m want to add in textbox  values from mysql and get total sum, but in text filed not load data from $var ? Help please.<br /> Thanks</p> ]]></content:encoded> </item> <item><title>By: Connor</title><link>http://viralpatel.net/blogs/2009/07/sum-html-textbox-values-using-jquery-javascript.html/comment-page-1#comment-21639</link> <dc:creator>Connor</dc:creator> <pubDate>Wed, 04 Jan 2012 15:33:08 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=1583#comment-21639</guid> <description>None of the following work out on firefox..jquery is latest inbox type textbox  id sum name sum value $(“#sum”).val(sum.toFixed(2));  or $(“#sum”).html(sum.toFixed(2));textbox display: $(</description> <content:encoded><![CDATA[<p>None of the following work out on firefox..jquery is latest<br /> inbox type textbox  id sum name sum<br /> value $(“#sum”).val(sum.toFixed(2));  or<br /> $(“#sum”).html(sum.toFixed(2));</p><p>textbox display: $(</p> ]]></content:encoded> </item> <item><title>By: Viral Patel</title><link>http://viralpatel.net/blogs/2009/07/sum-html-textbox-values-using-jquery-javascript.html/comment-page-1#comment-20921</link> <dc:creator>Viral Patel</dc:creator> <pubDate>Mon, 02 Jan 2012 18:47:05 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=1583#comment-20921</guid> <description>@Martin - This is because you might not have copied jQuery javascript file in your folder containing HTML. Well that&#039;s not a problem. Just replace following line no. 19 in your HTML document:[code gutter=&quot;false&quot; language=&quot;js&quot;] &lt;script src=&quot;jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt; [/code]with this one:[code gutter=&quot;false&quot; language=&quot;js&quot;] &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&quot;&gt;&lt;/script&gt; [/code]Hope this works :)</description> <content:encoded><![CDATA[<p>@Martin &#8211; This is because you might not have copied jQuery javascript file in your folder containing HTML. Well that&#8217;s not a problem. Just replace following line no. 19 in your HTML document:</p><pre class="brush: jscript; gutter: false; title: ; notranslate">
&lt;script src=&quot;jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
</pre><p>with this one:</p><pre class="brush: jscript; gutter: false; title: ; notranslate">
&lt;script src=&quot;<a href="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&quot;&gt;&lt;/script&#038;gt" rel="nofollow">https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&quot;&gt;&lt;/script&#038;gt</a>;
</pre><p>Hope this works <img src='http://viralpatel.net/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: martin</title><link>http://viralpatel.net/blogs/2009/07/sum-html-textbox-values-using-jquery-javascript.html/comment-page-1#comment-20903</link> <dc:creator>martin</dc:creator> <pubDate>Mon, 02 Jan 2012 17:54:18 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=1583#comment-20903</guid> <description>Hi I am new to coding as my background is graphic design and electronics.  Sorry for being nieve but this is exactly what i need, i have copied the code and pasted it to a html doc the table shows up well but i cant get the maths to work? do I need to upload a script doc to my web space?Thanks, great work btw!</description> <content:encoded><![CDATA[<p>Hi I am new to coding as my background is graphic design and electronics.  Sorry for being nieve but this is exactly what i need, i have copied the code and pasted it to a html doc the table shows up well but i cant get the maths to work? do I need to upload a script doc to my web space?</p><p>Thanks, great work btw!</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: viralpatel.net @ 2012-02-09 10:08:57 -->
