JSFiddle - React, Tailwind, and code Playground

HTML

<html>
<body>
<a href="http://google.com" class="shortcut" shc="27">
    logout
  </a>
</body>
</html>

JavaScript

$(document).on("keydown", function(e) {
		console.log(e.which);
		checkElementType(e.which);
	});

	function checkElementType(shortcutKey){
		var element = $("[shc="+shortcutKey+"]");
		var elementType = element.prop('nodeName');
		//console.log(elementType)
    //console.log(element)
		switch(elementType){
			case 'A':
				// element.trigger('click');
				console.log(element);
				console.log('click the link');
			break;
		}
	}