Responsive landing page using flex, tailwindcss and javaScript
Design comparison
Solution retrospective
I notice that trying to open my screenshots from the README always load into an error page. Please what am I doing wrong?
Can someone also please hint me on proper form validation with JavaScript?
Community feedback
- @Aimal-125Posted over 1 year ago
Use this js code for validation:-
let regex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; function myfunc() { if(x.value == "") { y.style.visibility = "visible"; y.innerHTML = "Empty Field"; y.style.color = "hsl(0, 74%, 74%)"; q.style.border = "2px solid hsl(0, 74%, 74%)"; a.style.visibility = "visible"; } else if(!(x.value.match(regex))) { y.style.visibility = "visible"; y.innerHTML = "Please provide a valid email"; y.style.color = "hsl(0, 74%, 74%)"; q.style.border = "2px solid hsl(0, 74%, 74%)"; a.style.visibility = "visible"; } else if(x.value.match(regex)) { y.style.visibility = "visible"; y.innerHTML = "Valid email"; y.style.color = "green"; q.style.border = "1px solid hsl(0, 6%, 24%)"; a.style.visibility = "hidden"; } } z.addEventListener("click", myfunc);
where z is the pink button. y is the red error image. q is the div in which input element is. x is input type text. a is the p element in which error msg will display.
Marked as helpful0@suruainoPosted over 1 year agowow, that a whole lot of information. Thanks, I really appreciate.@Aimal-125
0 - @javascriptor1Posted over 1 year ago
Hello Suru ,
Please check my solution where you can find validation for email in Javascript.
Usually , a regular expression pattern is made then we check user input againt our pattern.
Marked as helpful0 - @matiasluduena23Posted over 1 year ago
Hi @suruaino! good work!
Your image is not in your code folder, put it in a folder and push again to github. And also use a .jpg image
Good luck!
0@suruainoPosted over 1 year agoHonestly I observed that too. I don't know while the image folder is always skipped when I push them together. I will try and find my way around it though. Thanks for your observation. @matiasluduena23
0 - @Aazeez257Posted over 1 year ago
Hello @suruaino, try uploading the screenshot to the same file location as the readme file example - screenshot.png not like this images/screenshot.png😊😉
0
Please log in to post a comment
Log in with GitHubJoin 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