JSFiddle - React, Tailwind, and code Playground

by Luke Marlow

HTML

<script src="https://www.lastknights.com/csjs/jquery.js"></script>
<script src="https://www.lastknights.com/csjs/jquery.js"></script>
<a class="shortcut button-w" href="index.php?page=wars"><u>W</u>ars</u></a><br />
<a class="shortcut button-m" href="index.php?page=maps"><u>M</u></u>aps</u></a><br />
<br />
<input name="input" value="input"><br />
<textarea name="textarea" style="height:20px; width:200px">textarea</textarea><br />
<br />
<div class="output">

</div>

CSS

.output{height:200px;width:200px;border:solid 1px black}

JavaScript

$(function() {
	$('html').keypress(function(e) {
    var elem = document.activeElement.tagName,
    		key  = String.fromCharCode(e.which);

		if (elem !== "TEXTAREA" && elem != "INPUT") {
      var check = $('a').hasClass('button-'+key);
      if (check) {
        document.location.href = $('.button-'+key).attr('href');
      }
    }
  });
});