I would like to know how, within a table I can change the labels of a particular tr (with several td, each with its label), without deleting the table and keeping the value of the labels.
-I've been testing with innerHTML, but it replaces the table ...
<script>
function change(){
var valor = document.querySelector("label").innerHTML;
document.querySelector("td").innerHTML = '<input type="text" value="' + valor + '"/>';
</script>
<table>
<tr>
<td><label>Label Ejemplo</label></td>
<td><button type="button" onclick="change();">Cambiar a input</button></td>
</tr>
<tr>
<td><label>Label Ejemplo1</label></td>
<td><button type="button" onclick="change();">Cambiar a input</button></td>
</tr>
<tr>
<td><label>Label Ejemplo2</label></td>
<td><button type="button" onclick="change();">Cambiar a input</button></td>
</tr>