JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false&amp;dummy=.js"></script>

    <input type="text" id="text" />

<input type="button" value="Test" id="test" />

JavaScript

$(document).on('keypress', '#text', function (e) {
    if (e.keyCode == 13) 
    {
    	e.preventDefault(); test();
    }
});
$(document).on('click', '#test', test);

function test() {
    alert('clicked');
}