JSFiddle - React, Tailwind, and code Playground
by kougiland
HTML
<input>
<div class="f1">ctrl+c</div>
CSS
.f1 {
width: 60px;
height: 60px;
line-height: 60px;
text-align: center;
border: 2px solid black;
margin: 4px;
}
JavaScript
$("input").keydown(function(e) {
var code = (e.keyCode ? e.keyCode : e.which);
if (code == 67) {
if (e.ctrlKey) {
alert("ctrl+c was pressed!!");
}
}
});
$(".f1").click(function() {
var e = jQuery.Event("keydown");
e.which = 67; // # Some key code value
e.ctrlKey = true;
$("input").trigger(e);
console.log(e);
});