I've used jQuery on and off for a couple of years but never enough to fully understand all the features. In the past I've used it to (say) sum up a column of inputs (on blur) and put the sum into a span as a total at the bottom of the column.
My challenge this time is that I've got to do subtotals. And I'm stuck. Hopefully the html below is self-explanatory. The html is dynamic but I have full control of it so I could add indexes or extra attributes etc. The number of inputs and subtotals is dynamic/variable.
Any help gratefully received.
- <table>
- <tr>
- <td><input class="number" /></td>
- </tr>
- <tr>
- <td><input class="number" /></td>
- </tr>
- <tr>
- <td><span class="subtotal" /></td>
- </tr>
- <tr>
- <td><input class="number" /></td>
- </tr>
- <tr>
- <td><input class="number" /></td>
- </tr>
- <tr>
- <td><input class="number" /></td>
- </tr>
- <tr>
- <td><span class="subtotal" /></td>
- </tr>
- <tr>
- <td><span class="total" /></td>
- </tr>
- </table>
-