JSFiddle - React, Tailwind, and code Playground

HTML

<center>
<input id='1' type='text' onfocus='1();'>
    <input id='2' type='text' onfocus='2();'>
        <br>
           <br>
        <button onclick='3();'>Button</button>
            </center>
        <script>
            var x;
            function 1() {
            x = '1';
            }
            function 2() {
            x = '2';
            }
            function 3() {
            alert(x);
            }
        </script>