richarddunnebsc
Active Coder
I have a html table as such: cell1 input button with AddRow click event, cell2 input text, cells 3 & 4 input number.

Onclick gives me this

I want to replace the AddRow with a DeleteRow on the button on the preceding row. The removeEventListener isn't working.
What am I doing wrong? Any help appreciated.

Onclick gives me this

I want to replace the AddRow with a DeleteRow on the button on the preceding row. The removeEventListener isn't working.
JavaScript:
var x=document.getElementById("TableName");
var node=x.rows[0].cloneNode(true);
x.appendChild(node);
var row = document.getElementsByName('Buttons').length-2;
document.getElementsByName("Buttons")[row].setAttribute("value","-");
document.getElementsByName("Buttons")[row].removeEventListener("click",AddRow);
HTML:
<input type="button" Name="Buttons" value="+" style="height: 30px; width: 100%;" onclick="AddRow();">
What am I doing wrong? Any help appreciated.