JSFiddle - React, Tailwind, and code Playground
HTML
<form action="#" method="post">
<div>
<input type="file" id="myfile" name="myfile" /> <a href="#" id="mylink" accesskey="o">Click me</a>
</div>
</form>
JavaScript
$("#mylink").click(function () {
$("#myfile").click();
});
$(window).bind('keydown', function (e) {
if (e.ctrlKey || e.metaKey) {
switch (String.fromCharCode(e.which).toLowerCase()) {
case 'o':
e.preventDefault();
console.log("1a");
$("#myfile").click();
//alert("hello");
console.log("1b");
return false;
}
}
return true;
});