I generated dynamic id for textbox but i cant get value from newly created textbox.
$(document).ready(function () {
function addRow() {
var html = '<tr>' +
'<td><select id="txtName" class="form-control"><option> Select Product</option><option> VITA-H 100ml</option><option> CAL-CM GOLD</option></td>' +
'<td><input type="text" id:"txtAmount_' + i + '" class="form-control" placeholder="Amount" onkeyup="calculateSubtotal();"></td>' +
'<td><input type="text" id="txtQyantity_' + i + '" class="form-control" placeholder="Qyantity" onkeyup="calculateSubtotal();"></td>' +
'<td><input type="text" id="txtTotalAmount_'+ i +'" class="form-control" placeholder="Total Amount"></td>' +
'<td><input type="button" id="btnadd" class="form-control btn btn-success" value="+ Add Product" /></td>' +
'<td><input type="button" id="btnremove" class="form-control btn btn-danger" value="- Remove Product" /></td>' +
'</tr>';
$(html).appendTo($("#Table1"));
i++;
};
$("#Table1").on("click", "#btnadd", addRow);
function deleteRow() {
var par = $(this).parent().parent();
par.remove();
};
$("#Table1").on("click", "#btnremove", deleteRow);
if ($("#txtTotalAmount").val().length == 0) {
$("#txtTotalAmount").val("0.00");
};
if ($("#txtsubtotal").val().length == 0) {
$("#txtsubtotal").val("0.00");
};
if ($("#DiscountApplied").val().length == 0) {
$("#DiscountApplied").val("0.00");
};
if ($("#TotalAmount").val().length == 0) {
$("#TotalAmount").val("0.00");
};
});
function calculateSubtotal() {
var Amount = document.getElementById('txtAmount_').value;
var Quantity = document.getElementById('txtQyantity').value;
var TotalAmount = Amount * Quantity;
$('#txtsubtotal').val(TotalAmount);
$('#txtTotalAmount').val(TotalAmount)
}
function calculateTotal() {
var Discount = document.getElementById('DiscountApplied').value;
var Subtotal = document.getElementById('txtsubtotal').value;
if (Discount > 0 && Subtotal > 0) {
var DiscountCalculate = (Discount * Subtotal)/100;
var Result = Subtotal - DiscountCalculate;
}
else {
var Result = 0;
}
$('#TotalAmount').val(Result);
}
Thank You