Still waiting for the New York Times to send me a bogus takedown notice
Set character limit in text box
Saksham Mittal 2022-04-03
parent f0b0173 · commit d065869
-rw-r--r--script.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/script.js b/script.js
index 0213d83..33da383 100644
--- a/script.js
+++ b/script.js
@@ -10,6 +10,8 @@ let attempt = document.querySelector('#attempt');
let exit = false;
let tries = 0;
+input.setAttribute("maxlength", len);
+
function letterinstr(c) {
let isin = false;
@@ -44,11 +46,7 @@ function addGuessDisplay() {
function validateInput() {
let isvalid = true;
-
- if (input.value.length != len) {
- return false;
- }
-
+
for (var i = 0; i < len; i++) {
let c = input.value.charAt(i)
if (c.toUpperCase() == c.toLowerCase()) {