1
I have a table whose contents come from a json that consists of a column with a number, one with a name and one with two buttons, changing and deleting the row. When I click the button to create a new line it inserts the number and the name but I can’t get it to insert the buttons.
This is the function I use to create the rows in the table
$(function(){
$(".row").click(function(){
var Cdgrupo = $("#Cdgrupo").val();
var Grupo = $("#Grupo").val();
var Acao = $("#Acao").val();
var markup = "<tr><td>" + Cdgrupo + "</td><td>" + Grupo + "</td><td>"+ Acao +"</td></tr>";
$("table tfoot").append(markup);
});
});
But what your difficulty there, is not only creating the buttons as you did with the tr and td?
– LeAndrade
So I’m trying like this, creating the tr and td the same way I did the other two but for some reason it’s not going, on the table is just the space reserved for where they should be.
– Gabriel Midão
In this case, the buttons would be in this variable called Action?
– Gabriel Roberto
This, in the variable Acao
– Gabriel Midão
Try to catch the element using only $("#Action")
– Gabriel Roberto
What do you mean? I’m still learning Jquery kkk
– Gabriel Midão
Do you want to get the right element? But when you use $("Action"). val(), you’re taking the value of the element.
– Gabriel Roberto
Oh I get it, I’ll try without using the . val then. The buttons I’m trying to insert are written in html, using <a> and <button> tags, is there a problem?
– Gabriel Midão
I don’t think so.
– Gabriel Roberto