I have dynamically added rows using javascript.now I have to sum the values in the text boxes.if i click add button the same row will be added.now i have one fixed textbox.if i enter the values in the textbox it should add and get displayed in the fixed textbox on keypress.how can i do this with javascript or jquery
here is my html and jquery scripts to addd the row
input id="name" type="text" input id="add" type="button" value="+" input id="Button1" type="button" onclick="removeRowFromTable();" value="x"
I have used jquery to add the rows dynamically and javascript to delete the rows
$(document).ready(function()
{
$("#add").click(function() {
$('#mytable tbody>tr:last').clone(true).insertAfter('#mytable tbody>tr:last');
$('#mytable tbody>tr:last #name').val('');
$("#mytable tbody>tr:last").each(function() {this.reset();});
return false;
return false;
});
});
function removeRowFromTable() { var tbl = document.getElementById('mytable'); var lastRow = tbl.rows.length; if (lastRow > 2) tbl.deleteRow(lastRow - 1); }