JSFiddle - React, Tailwind, and code Playground

HTML

<input id="scriptBox" type="text" onkeypress="return runScript(event)"></input>

JavaScript

var runScript = function(e) {
    if (e.keyCode == 13) {
        var tb = document.getElementById("scriptBox");
        alert(tb.value);
        return false;
    }
    else {
     return true;
    }
}