JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="theinput"/>
<br/>
<input type="button" class="button" value="button01"/>
<br/>
<input type="button" class="button" value="button02"/>
<br/>
<input type="button" class="button" value="button03"/>
<br/>
<input type="button" class="button" value="button04"/>
<br/>
<input type="button" class="button" value="button05"/>

JavaScript

var theButtons = $(".button");

$(theButtons).each(function(index) {
    currentButton = $(this);
    buttonValue = currentButton.val();
    currentButton.click(function() {
        $("#theinput").val(buttonValue);
    });

});