I have a table of invoice numbers, dates and totals due. I would like the selected total returned to jQuery in a variable. PHP is presently generating the table so if it helps to add unique ID's to the inputs or modify the HTML output, that isn't a problem at all.
I've done some research into it and it seems there are a million ways to achieve what I'm looking for; from concatenating the ID's and Prices in the Input ('5:75.97' style) and then separating them for manipulation, all the way to searching through the HTML for the nearest checkbox and adding the numbers that way. They all seem like they would work; just curious to learn what the ideal solution is.
For example, if Invoice 5 and 12 were selected, a variable would equal 106.94
Any help would be greatly appreciated.
<table>
<tr>
<th>Invoice #</th>
<th>Date</th>
<th>Balance</th>
</tr>
<tr>
<td><input type="checkbox" name="Invoices[]" value="" /> Invoice 5 </td>
<td>2015-03-03</td>
<td>75.97</td>
</tr>
<tr>
<td><input type="checkbox" name="Invoices[]" value="" /> Invoice 8</td>
<td>2015-03-07</td>
<td>35.97</td>
</tr>
<tr>
<td><input type="checkbox" name="Invoices[]" value="" /> Invoice 12</td>
<td>2015-03-01</td>
<td>30.97</td>
</tr>
</table>