Pessoa tenho o seguinte trecho de um codigo
// Função responsável por inserir linhas na tabela
function inserirLinhaTabela() {
// Captura a referência da tabela com id ?minhaTabela?
var table = document.getElementById("tabela");
// Captura a quantidade de linhas já existentes na tabela
var numOfRows = table.rows.length;
// Captura a quantidade de colunas da última linha da tabela
var numOfCols = table.rows[numOfRows-1].cells.length;
// Insere uma linha no fim da tabela.
var newRow = table.insertRow(numOfRows);
var nrCidadao = document.getElementById("nrCidadao").value;
var periodode = document.getElementById("periodode").value;
var periodoAte = document.getElementById("periodoAte").value;
var uf = document.getElementById("uf").value;
// Faz um loop para criar as colunas
// Insere uma coluna na nova linha
var cellConselho = newRow.insertCell(0);
var cellUf = newRow.insertCell(1);
var cellNrCidadao = newRow.insertCell(2);
var cellPeriodoDe = newRow.insertCell(3);
var cellPeriodoAte = newRow.insertCell(4);
var cellAcao = newRow.insertCell(5);
// Insere um conteúdo na coluna
cellConselho.innerHTML = "conselho";
cellUf.innerHTML = uf;
cellNrCidadao.innerHTML = nrCidadao;
cellPeriodoDe.innerHTML = periodode;
cellPeriodoAte.innerHTML = periodoAte;
cellAcao.innerHTML = " <input type='button' \n\
value='Editar' \n\
style='width:80px' \n\
onclick='javascript:editRow(nrCidadao);'/> \n\
<input type='button' value='Excluir' style='width:80px'/>"
}
o codigo acima monta uma tabela e criei um botão para editar esses registros:
criei uma função ‘editRow();’
function editRow(op){
alert(op);
document.getElementById('nrCidadao').innerHTML = op;
}
meu codigo ate chama essa função so que no alert me aparece “[ObjectHTMLInputElement]”??
o que pode estar errado ? Algeum poderia me ajudar por favor?