1
I have a dynamic table fed via Ajax that returns the following code through a foreach
:
<tr>
<td hidden value='{$conteudo['contId']}' id='contId'>
{$conteudo['contId']}
</td>
<td>
{$conteudo['contNome']}
</td>
<td class='elementoNaDireita' >
<button class='btn btn-outline btnExcluiArquivo'onclick='excluiArquivo();' name='btnExcluiArquivo' data-toggle='modal' data-target='#modalExcluiArquivo'>
<span class='glyphicon glyphicon-floppy-remove btnExcluiArquivo'>
</button>
</td>
</tr>
And the function excluiArquivo()
that’s the one:
function excluiArquivo(){
var contId = $('td:first', $(this).parents('tr')).text();
console.log(contId);
// document.getElementById('contId').value = contId;
$("#contId").val(contId);
}
For some reason the variable contId
does not receive the tag value <td>
, receives nothing.
Could someone help me?
It came to nothing! The intriguing thing is that on the same page I have a table that has this same logic and works, except that the one that is returned by ajax does not work
– Matheus Antonio