+ 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
+ 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!");
}
}
0
After submit is clicked or ?
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>
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.