JSFiddle - React, Tailwind, and code Playground

by Ryan Mitchell

HTML

<button type="button" id="button0" onClick="reply_click(this.id)">button0</button><p></p>
    <button type"button" id="button1" onClick="reply_click(this.id)">button1</button><p></p>
    <button type"button" id="button2" onClick="reply_click(this.id)">button2</button><p></p>
    <textarea id="myArea"></textarea>

<button onClick="document.getElementById('button0').focus()">Focus button 1</button>

JavaScript

function reply_click(clicked_id){
var id= clicked_id;
var myTextArea = document.getElementById('myArea');
myTextArea.innerHTML += id;
document.getElementById(id).focus(); 
};