I am trying to allow the user to click on a span element and change the text according to what they type along with the original textcontent.
container.addEventListener('click', (event) => {
if (event.target.classList.contains('targetSpan')){
targetSpanText = event.target.textContent;
document.addEventListener("keydown", (event) => {
targetSpanText.textContent += `${event.key}`;
});
}
});
The textcontent does not seem to update, although the the keydown event listener is working.