An event seems to start automatically even if it is not called. It should only start if something is typed.
The code automatically takes each cell and applies an event to the click that causes a box to appear and according to the cell changes the information contained in them where there is an input which in turn has an event when something is typed but starts automatically .
After a cell is clicked (elementToChange is the inner text of the clicked cell): js
function changeMemberSurname(elementToChange) {
var showOptions = document.getElementById("showChangeOptions");
showOptions.className = "show";
var input = document.createElement("input");
input.value = "Surname";
input.type = "text";
input.id = "ChangeMemberInput";
input.name = "Surname";
input.addEventListener("keyup", changeMemberOldNew(elementToChange));
showOptions.appendChild(input); //append it to the empty div
};
function changeMemberOldNew(elementToChange) {
var inputValue = document.getElementById("ChangeMemberInput").value;
var showValue = document.getElementById("showChangeText");
showValue.innerText = "before: " + elementToChange + " - after: " + inputValue + ".";
};
changeMemberOldNew is the function that starts automatically but should not. Why it autostart? Thanks in advance.