Fiddle
I have two tables. When I click on one table row it will copy to another table, and I will change the button as my requirement. Please help me.
$(window).load(function() {
var items = [];
$(".addBtn").on("click", function() {
var newTr = $(this).closest("tr").clone();
var newButtonHTML = "<input type = 'button' value='Edit' onclick='Edit()' /><input type='button' value='Delete' onclick='deleteRow(this.parentNode.parentNode.rowIndex)'/>";
$(newButtonHTML).children("button").click(function(e) {
});
$(newTr).children("td:last").html("").html(newButtonHTML);
items.push(newTr);
newTr.appendTo($("#stopsTable"));
});
At your example it was a wrong selector
$('#myTable.tr')
instead of
$('#myTable tr')
Check fixed version: http://jsfiddle.net/V7wXD/7/
Best regards!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With