My HTML:
<table id="laboral">
<tr>
<td><input type="text" name="start"/></td>
<td><input type="text" name="end"/></td>
<td><textarea name="desc"></textarea></td>
<td><button type="button" onclick="saveRow(this);"> + </button></td>
</tr>
</table>
When I press the +
button I create a new row exactly as the first one, but the onclick
event doesn't work:
Here's the code for saving the values and create the 2 input
s and the textarea
:
var button = document.createElement("button");
button.type = "button";
button.setAttribute("onclick", "saveRow(this);")
button.innerHTML = "+";
var btn = tr.insertCell(3);
btn.appendChild(button);
If I examine the result with Firefox I can see that the first button and the new generated have the same code. But the generated doesn't work.