I made a function name edit(index). index is the id number of h1 tag elements. Whenever i click the edit button (which is has id index) then the input text appear for me to adding some text therefor i can submit another button.
function saveChange(index) {
if(editName.value != "") {
productList[index] = editName.value;
}
spoiler.style.display = 'none';
}
//and here i call the event
function edit(index) {
spoiler.style.display = "block";
document.getElementById('save').addEventListener('click',saveChange(index));
}
how can i pass the index parameter?