0
I am creating a function to save a form directly in a table, the table rows contain an onclick function that takes them to function in javascript
function xpto() {
if (linha == null) {
var linha1 = document.getElementById("tabela").insertRow(-1);
linha1.insertCell(0).innerHTML = document.getElementById("oT").value;
linha1.insertCell(1).innerHTML = document.getElementById("tColeta").value;
linha1.insertCell(2).innerHTML = document.getElementById("tEntrega").value;
linha1.insertCell(3).innerHTML = document.getElementById("pEntrega").value;
linha1.insertCell(4).innerHTML = document.getElementById("trans").value;
linha1.insertCell(5).innerHTML = document.getElementById("mod").value;
} else {
linha.cells[0].innerHTML = document.getElementById("oT").value;
linha.cells[1].innerHTML = document.getElementById("tColeta").value;
linha.cells[2].innerHTML = document.getElementById("tEntrega").value;
linha.cells[3].innerHTML = document.getElementById("pEntrega").value;
linha.cells[4].innerHTML = document.getElementById("trans").value;
linha.cells[5].innerHTML = document.getElementById("mod").value;
}
linha = null;
mostrarTabela();
}
how I insert attributes into the new row created by the save option, in case I have to insert the html effect onclick="editar(this)";
var linha1 = document.getElementById("tabela").insertRow (-1);
Your question is not yet clear to me. You can join HTML and the rest of the code to see an example working?
– Sergio
Sérgio is seeing the function foo(), so follow along with me I will try to make it clear, if (line == null) { var line1 = Document.getElementById("table"). insertRow(-1);, know this Insert Row(-1) it inserts a new line only that without any property, I need to pass this new line created <tr> an onclick event="edit" or a class="effect", for the line to be in agreement with the others.
– VeteranoKuno1