const input = document.getElementById('input');
const items = document.querySelectorAll('.text-item');
const setValueToInput = ({ target: { textContent } }) => {
input.value = textContent.trim();
}
for (const item of items) {
item.addEventListener('click', setValueToInput);
}