I would like to be blunt; I am weak with Javascript/Jquery. I am learning :) I am very strong in PHP.
I have a table that shows a user a single line item that they can enter information into. This form is a "change order". I am having difficulties understanding what I need to do to get the input fields "Count" and "Price" to sum by the example in the Total Category. I would also need to have this summation occur during each new row inserted.
This page will generate a template'd PDF document containing the line items entered.
My Javascript code ive put together is;
let count = 0;
$('p input[type="button"]').click(function () {
count += 1;
})
$('#myTable').on('click', 'input[type="button"]', function () {
$(this).closest('tr').remove();
})
$('p input[type="button"]').click(function () {
var varItem = 'item_' + count;
var varCount = 'count_' + count;
var varPrice = 'price_' + count;
var varTotal = 'total_' + count;
$('#myTable').append('' +
'<tr>' +
'<td>' +
'<input type="text" class="form-control" name="' + varItem + '"/>' +
'</td>' +
'<td>' +
'<input type="text" class="form-control" name="' + varCount + '"/>' +
'</td>' +
'<td>' +
'<input type="text" class="form-control" name="' + varPrice + '"/>' +
'</td>' +
'<td>' +
'Count * Price = Total' +
'</td>' +
'<td>' +
'<input type="button" class="btn btn-sm btn-danger" value="Delete" />' +
'</td>' +
'</tr>'
)
});
HTML
<table id="myTable" class="table table-hover table-striped width-full">
<thead>
<tr>
<th>Item</th>
<th>Count</th>
<th>Price</th>
<th>Total</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="text" class="form-control" name="item_0" />
</td>
<td>
<input type="text" class="form-control" name="count_0" />
</td>
<td>
<input type="text" class="form-control" name="price_0" />
</td>
<td>
Count * Price = Total
</td>
<td>
<input type="button" class="btn btn-sm btn-danger" value="Delete" />
</td>
</tr>
</tbody>
</table>


jQuerycode and notjavascript.;and the$and you are strong in js too :Pptag ` $('p input[type="button"]')`. You want total to be displayed as new row is created? I am not really clear about the question. But, when new row is added the price and count input fields are empty.