I am trying to add a new row to the table. The new row is duplicate of the next row with few changes. The new row would remove all the rows in the nested table but the first row. I have created a JSFiddle link where you can find more details and the code:
var rowId = $("#menu").attr("rowId");
var currentRow = $("#" + rowId);
var rowToBeAdded = currentRow.next();
rowToBeAdded.clone().insertAfter(currentRow)
.find(".TBLCONTENTS:not(:first),.TBLALTCONTENTS:not(:first)").remove();
For some reason the following works but the above does not:
rowToBeAdded.clone().insertAfter(rowToBeAdded).find(".TBLCONTENTS:gt(0),.TBLALTCONTENTS:gt(0)").remove();