I have a table with a "zebra-stripe" CSS3 class:
.zebra-stripe tr:nth-child(odd) {
background-color: #c6e1ff;
}
.zebra-stripe tr:nth-child(even) {
background-color: #eeeeee;
}
Above the table is an entry field, whereupon a user submit will prepend a row with JQuery and POST.
This happens with:
function submit(id) {
$.post(
"URL", // uses template toolkit 'c.uri_for' to actually add message in database
{
msgtype: 'some-type',
msg: $('#some-id').val()
},
function (data) {
$('#table-id').prepend(data);
}
);
$('#some-id').val('');
return false;
}
This code prepends a row at the top of my table, and all the CSS is fine and dandy. However, upon removing any given row (each row has a "remove" button), using the following JQUERY with a GET:
function remove(id1,rowid) {
// uses template toolkit 'c.uri_for' to actually remove message in database
$.get('URL', function (data) {
$('#' + rowid).hide();
});
//attempt to reapply styles
$('#field-note-table').removeClass("zebra-stripe");
$('#field-note-table').addClass("zebra-stripe");
return false;
}
does not reapply the CSS (breaks the zebra-striping). How do I get it to re-apply the CSS after having removed the row?
removemetohod? - Shaddowc.uri_forcall to actually add or remove the message in the database. So it's being hidden, but it is also being removed in the background. - skipprremovefunction when clicked. - skippr