I'm starting the studies in jQuery and I have the following doubt:
I have a table created in HTML. This table contains only one line with th
's. The records are inserted by jQuery. Through interaction with the user, the data is obtained and saved in variables, then added to the table with append
:
$("table").append("<tr><td>" + nome + "</td><td>" + quantidade +
"</td><td>" + valor + "</td><td>" + dataFormatada + "</td><td>" +
acoes + "</td></tr>");
So far, everything works correctly and I can insert all the records.
The actions variable was defined as follows:
var acoes = "<a href='#' class='exclui'>Excluir</a> <a href='#' class='cor'>Mudar Cor</a>";
That is, I would like to be allowed to delete and change the color of each record. For the first part, I already tried hide
, remove
and the code below, but nothing worked:
$(".exclui").click(function() {
//$(this).parent().remove();
});
I imagine it to be simple, but I could not. Can someone help me? Thank you.