Just some of the HTML, but it's the whole alphabet. I want to click any button and that letter will go in the text box. Do i have to create getelementbyID for each button or can I create some kind of loop? html - this is the html and it is basically the alphabet.
<div id="alpha" >
<br/>
<div align="center">
<button id="q" class="letters">Q</button>
</div>
<div align="center">
<button id="w" class="letters" onclick="theclick()">W</button>
</div>
<div align="center">
<button id="e" class="letters">E</button>
</div>
<div align="center">
<button id="r" class="letters">R</button>
</div>
<div align="center">
<button id="t" class="letters">T</button>
</div>
**THIS IS THE JAVASCRIPT I HAVE. I only have the onclick function for button "w" for testing**
javascript - this is the javascript, it's not working but want to do some kind of loop to make it a more simple javascript code
<script>
function theclick() {
var x = document.getElementByClassName("letters").innerHTML;
document.getElementById("textbox").value = x;
};
</script>