Intro-sign-up form

Solution retrospective
How to get red border on wrong entry, also why my email validation is not working? kindly help!
Please log in to post a comment
Log in with GitHubCommunity feedback
- @manojks092
Hey there, if you want to input to turn red or any other color when incorrect, then use outline property in javascript. Like this :
inputElement.style.outline = " 2px solid red"
; PS: here inputElement is the reference to the form input element , can be for password or text. Hope you'll find it helpful. Happy coding :DMarked as helpful - @skyv26
Lol! you instead of using Match Regex you directly compare it with the String
if(email_add == "/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/"){ setTimeout(() => { document.getElementById("email-error").style.display = "none"; }, 3000); document.getElementById("email-error").style.display = "block"; }
Above is wrong
if(email_add.match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/){ setTimeout(() => { document.getElementById("email-error").style.display = "none"; }, 3000); document.getElementById("email-error").style.display = "block"; }
Now it is correct. Update your code and recheck again.
There are other problems too. I think you have to go through again from your CSS and JS too.
Good Luck
Marked as helpful
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord