I am pretty new to jquery and fooTable.
What I want to do is to combine the add and delete jquery functions provided by FooTable, such that when I add a row, it automatically deletes the last row in that table.
Would greatly appreciate some help here. Thanks!
//This piece of code deletes a row
$('table').footable().on('click', '.row-delete', function(e) {
e.preventDefault();
//get the footable object
var footable = $('table').data('footable');
//get the row we are wanting to delete
var row = $(this).parents('tr:first');
//delete the row
footable.removeRow(row);
});
//This piece of code adds a row
$('.add-row').click(function(e) {
e.preventDefault();
//get the footable object
var footable = $('table').data('footable');
//build up the row we are wanting to add
var newRow = 'Some content here'
//add it
footable.appendRow(newRow);
});