I have an HTML table and I'm creating your lines dynamically using appendChild()
, I'm just not able to set className
dynamically on those lines, in the third column - "VALUE".
See like this:
var doc = document;
function inserirLinha(id) {
var newRow = doc.createElement('tr');
newRow.insertCell(0).innerHTML = 'ID';
newRow.insertCell(1).innerHTML = 'NOME';
newRow.insertCell(2).innerHTML = 'VALOR';
doc.getElementById(id).appendChild(newRow);
return false;
}
<form onsubmit="return inserirLinha('minhaTabela')">
<table>
<tr>
<tbody id="minhaTabela"></tbody>
</tr>
</table>
<input type="submit" value="Adicionar" name="submit">
</form>