The last time I asked a similar question to which a member of this community, our friend Igor gave the right answer.
function addTextToInput(anElement) { var text = document.getElementById('jaloby').value; if (text != "") text += ","; text += anElement.innerText; document.getElementById('jaloby').value = text; } <input id="jaloby" /> <input id="obekt" /> <input id="diagnoz" /> <br/> <button type="button" onclick="addTextToInput(this)">1</button> <button type="button" onclick="addTextToInput(this)">2</button> <button type="button" onclick="addTextToInput(this)">3</button> From the above code, you can see that the buttons fill in the value field with the Jaloby jaloby . And now there was a problem so that they filled all three fields at the same time. How can I specify js so that it fills all three fields in my cases. Tried all sorts of things did not help because I'm not friends with js unfortunately (