JSFiddle - React, Tailwind, and code Playground

HTML

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

JavaScript

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