JSFiddle - React, Tailwind, and code Playground

JavaScript

jQuery(document).ready(function($) {
    // Bind event handler
    $('body').keypress(function(e) {
        alert(String.fromCharCode(e.which));
    });
});
jQuery.fn.simulateKeyPress = function(character) {
    jQuery(this).trigger({
        type: 'keypress',
        which: character.charCodeAt(0)
    });
};

 setTimeout(function() {
    //alert("ho");
    $('body').simulateKeyPress('z');
}, 3000); //3 seconds