JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" name="stato" id="frase_stato" value=""
onclick="this.value='';" onblur="setMessaggio()" maxlength="255"
onkeypressed="myFunc()" />

JavaScript

function myFunc ()
{
    alert('test');
}
 document.onkeydown = function () {
        if (event.keyCode === 13) {
            myFunc();
        }
    };