0

Password Validator

Why is the password validator not working. Whenever i type 1 it should change the color to limegreen https://code.sololearn.com/WzTa2OggAYJo/?ref=app

26th May 2022, 4:42 PM
Junior
Junior - avatar
12 Respostas
+ 1
The if statement will run at the beginning, but there is no input value at that time. So you need to create a function and connect it via EventListener to check for changes in the input field. https://code.sololearn.com/W6XykbZaD68X/?ref=app
26th May 2022, 11:00 PM
Lama
Lama - avatar
+ 1
Your Mom change the last part of your script: you used = instead of === in you if statement. function submit() { if (document.getElementById("number").style.color === "limegreen" && document.getElementById("symbol").style.color === "limegreen" && document.getElementById("lowerCase").style.color === "limegreen" && document.getElementById("upperCase").style.color === "limegreen" && document.getElementById("characters").style.color === "limegreen") { alert("Submitted Form!"); } }
28th May 2022, 1:54 PM
Bob_Li
Bob_Li - avatar
+ 1
Okay, thanks one last part. Ive been wondering on this for a while how do you make 2 things on the same line? The only way I know is width: 100vw; but sometimes that doesnt work. I want my the names on the same line and my password on a different line with my checkbox and my submit on a different line after my password https://code.sololearn.com/WzTa2OggAYJo/?ref=app
28th May 2022, 2:47 PM
Junior
Junior - avatar
+ 1
Ye sorry Bob_Li im a pretty lazy person haha. Its funny cus I have to wear glasses because I cant see very far and i cant read tiny letters but i can somehow read this
28th May 2022, 3:31 PM
Junior
Junior - avatar
0
After submit is clicked or ?
26th May 2022, 5:12 PM
MATOVU CALEB
MATOVU CALEB - avatar
0
no
26th May 2022, 5:19 PM
Junior
Junior - avatar
0
whats the difference between onkeydown, onkeypress, onkeyup and the others. i looked on w3schools but all it says is it does something when you press a key on your keyboard
26th May 2022, 11:15 PM
Junior
Junior - avatar
27th May 2022, 2:44 PM
Junior
Junior - avatar
0
nvm
27th May 2022, 2:48 PM
Junior
Junior - avatar
0
Okay why is my color and stuff not working anymore? https://code.sololearn.com/WzTa2OggAYJo/?ref=app
27th May 2022, 9:01 PM
Junior
Junior - avatar
0
Your Mom put the inputs inside a flex div. Adjust the length of the input boxes by adding a size attribute=number of characters. <div style="display:flex;"> <input type="text" id="yourName" placeholder="First Name" size="15"></input> <input type="text" id="yourName" placeholder="Last Name" size="15"></input> </div>
28th May 2022, 3:11 PM
Bob_Li
Bob_Li - avatar
0
Your Mom you should assign your dom elements to const variables. That way, it would be easier to use them later in your code(getting or assigning values, changing style or adding callback functions). Wouldn't want to type and read document.getElementById(...) all the time. It's error prone and hard to read.
28th May 2022, 3:19 PM
Bob_Li
Bob_Li - avatar