function addTextToInput(anElement) { var text = document.getElementById('jaloby').value; if (text != "") text += ","; text += anElement.innerText; document.getElementById('jaloby').value = text; }