JSFiddle - React, Tailwind, and code Playground
by shanabus
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Adding Tabs</title>
</head>
<body>
<br />
<label>Type here:</label> <input type="password" id="myText" />
<div id="divCaps" style="display:none;border:1px solid red;">Caps Lock is on.</div>
</body>
</html>
JavaScript
$(function() {
$("#myText").keypress(function capLock(e) {
kc = e.keyCode ? e.keyCode : e.which;
sk = e.shiftKey ? e.shiftKey : ((kc == 16) ? true : false);
if (((kc >= 65 && kc <= 90) && !sk) || ((kc >= 97 && kc <= 122) && sk)) {
$('#divCaps').show();
} else {
$('#divCaps').hide();
}
});
});