JSFiddle - React, Tailwind, and code Playground

HTML

<label for="txtMessage">Message text:</label>
<input type="text" id="txtMessage" value="" />
<input type="button" id="myButton" value="Display Message" />
<div id="divOutput" />

JavaScript

var txt = $('#txtMessage');

$('#myButton').click(txt , function(event){
    /*
     * I would not to referer UI elements here
     * Rather I would pass the $('#txtMessage').val() to the handler
     */
   
    $('#divOutput').html(event.data.val());
});