javascript - Jquery Table Sum -


Every time I click the "+" button and add each column, trying to create rows I am here. I can create columns but no row.

This is my code:

  $ (document) .ready (function () {$ ("# tabla"). Click (function () ($ & Amp; nbsp;; & lt; input type = "text" value = "0" & ​​gt; & lt; / td & gt; '); $ ("(" (TD: final "). (' & Lt ; Td & gt; & lt; input type = "text" value = "1" & gt; & lt; / td & gt; '); $ ("input"). (Function () {$ (this) .keyup (function () {newSum.call (this);}}}};});}); function newSum () {var sum = 0; var thisRow = $ (this) .closest ('tr') ; Var total = 0; $ (ThisRow) .Find ("TD: no (gross) input"). Each (function () {sum + = parseInt (this.value);}); $ (ThisRow) .find "Total.") HTML (sum). $ ('Total') Each (function () {total + = parseint ($ (this) .html ());});}   

thanks in advance.

I finally resolved this problem.

Here is the code: < pre> // lines lines $ ('# Sum_table tr: no (.totalCol) input: text'). Bind ('funnel changes', function () {var $ table = $ (this) .closest ( 'Table'); Var total = 0; Var this number = $ (this) .attr ('class'). Match (/ (\ d +) /) [1]; $ Table.find ('tr: no (.totalCol) .sum' + thisNumber) .each function () {total + = parseInt (this.value);}); $ Table.find ('total call TD: nth-child (' + + this number + ')'). Html (total);});

Here's the full code:



Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -