JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="theTextBox"/>
<input type="button" id="theButton" value="Ok" onclick="theButtonClick()"/>
JavaScript
function theButtonClick()
{
var theVariable = document.getElementById("theTextBox").value;
alert(theVariable);
}