kvitochka13,
if (target.className == 'ok') {
target.parentElement.classList.remove('active');
target.parentElement.innerHTML = target.parentElement.querySelector('textarea').value;
if (selectedTd.split(' ')[1] == 'active') { selectedTd = selectedTd.split(' ')[0]; }
}