On click of the Copy link in a row, I need to create another row and copy all its contents to the new row. This is the code I have:
addNewInlineRow(sid, idToUse); // this creates a new row with empty values
//this copies the value from old row to new row
$("#"+rowId+ " td").each(function(index){
$("#"+idToUse+ " td").get(index).text($(this).text());
});
But this code is not working. Any suggestions? I cannot clone the entire TR due to existing complex logic for creating TR id!!
When you use
.get()you’re retrieving the DOM element, it is not a jQuery object, therefore you can not use.text()to set the text value. Try: