JSFiddle - React, Tailwind, and code Playground
by atheer Salim
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form id ="forms">
<h3>Username</h3>
<input type="text" id="uname">
<h3>Password</h3>
<input type="text" id="passw">
<button>Log in</button>
</form>
</body>
</html>
JavaScript
$(document).ready(function() {
$("#forms").keydown(function(tangent) {
var nummer = tangent.keyCode;
if (nummer == 78) {
var passw = $("#passw").val();
if (passw.length > 7) {
$("#passw").css("background-color", "white");
$("#passw").prop("disabled", true);
} else{
$("#passw").css("background-color", "red");
}
$("#uname").prop("disabled", true);
}
});
});