JSFiddle - React, Tailwind, and code Playground

JavaScript

function enter(event)
{
    alert(event);
};

var input = document.createElement("input");

input.onkeypress = enter;

document.body.appendChild(input);