JavaScript DOM Scripting By Example Editing and Filtering Names Moving to an Editing State

Saqib Ishfaq
Saqib Ishfaq
13,912 Points

my solution

else if (e.target.textContent = 'Save'){
            const input = li.firstElementChild;
            const newSpan = document.createElement('span');
            newSpan.textContent = input.value;
            li.replaceChild(newSpan, input);
            e.target.textContent = 'Edit'
        }