JSFiddle - React, Tailwind, and code Playground

HTML

<form>
    <textarea id="textarea1"></textarea>
    <textarea id="textarea2"></textarea>
    <textarea id="textarea3"></textarea>
  </form>
  <p id="p1"></p>
  <button type="button" id="button1" onclick="printTagName()">Press</button>

JavaScript

var focusElement = {};

$("textarea").focus(function(){
   focusElement = this;
});

$("#button1").click(function(e){
    e.preventDefault();
    $("#p1").html($(focusElement).attr("id"));
});