I have below HTML table, on Add to table click a new is added each time with price and quantity input fields, how to sum all on Sum() click.
- <button onclick="AddToTable()">Add to Table</button>
- <button onclick="Sum()">get Invoice</button>
- <table id="table" class="table table-bordered">
- <thead>
- <tr>
- <td>Quantity</td>
- <td>Price</td>
-
- </tr>
- </thead>
- <tbody>
-
- </tbody>
- </table>
- function AddToTable()
- {
- var trr = document.createElement("tr");
- $(trr).append("<td>" + "<input type='text'/>" + "</td>").append("<td>" + "<input type='text'/>" + "</td>");
- $("#table tbody").append(trr);
- }