I have tables in each tab, as shown in http://jsfiddle.net/Us8uc/5020/
The rows in each table has to be added and removed on button click.
I am replicating the row add function $("#anc_add2").click(function() {} and row remove function $("#anc_rem2").click(function(){ for each table with a different table id e.g. tabl1, tabl2, tabl3 etc.
The following function is important for adding and removing the rows in table:
$('#tbl2 tr').last().after(rowdata);
$('#tbl2 tr:last-child').remove();
How do I pass a TAB number as a parameter to a function so the table id can be generated with a variable and the variable can be used; something like this:
function onBtnClick(tabnumber) {
var tableid = "tabl" + tabnumber;
$(tableid tr).last().after(rowdata);
$(tableid tr:last-child').remove();
}
sample code is available at http://jsfiddle.net/Us8uc/5020/