troubleshooting Question

jquery: summing dynamic elements?

Avatar of n00b0101
n00b0101 asked on
1 Comment1 Solution373 ViewsLast Modified:
I have a form, where, once you begin to add text, another row beneath it will appear.  (The code for that is below).  I'm trying to figure out how to sum these values on input as they're added?  
// this is the jquery that appends a row
$( function(){
        $("#dnotes > tbody > tr > td > input").bind('focus', function(){
                        var row = $(this).closest("tr").get(0);
                        if( row.className.indexOf("clicked")==-1 )
                                var rowCopy=$(row).clone(true);
                                var newInput=$("input",rowCopy).get(0);
// this is the accompanying html
<td><input type="text" id="diningroomemployee" name="drlabor[employee][]" /></td>
<td><input type="text" name="drlabor[othours][]" value=""  /></td>
<td><input type="text" name="drlabor[dthours][]" value=""  /></td>
<td><input type="text" name="drlabor[break][]" value="" /></td>
<td><input type="text" name="drlabor[shift][]" value="" class="standardTextfieldSmall" /></td>
// this is where I want to put the totals for drlabor[othours][], etc.
<td id="totalothours"></td>
<td id="totaldthours"></td>
<td id="totalbreak"></td>
<td id="totalshift"></td>
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros