Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Used HTML and CSS without JavaScript

Shahin• 95

@Shahinthecoder

Desktop design screenshot for the Base Apparel coming soon page coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


I could not add the JavaScript code for this website. It will be much appreciated if you can help me with this.

Community feedback

Wesley• 60

@Wesleys-hub

Posted

Hey man, i would sugget adding an id to the form and the input. Make the styles following the design (active-states) image and add them when the user fills in either a correct or a wrong input

// get the form and input const form = document.getElementById("form"); const email = document.getElementById("email");

// add event listener to button form.addEventListener("submit", (e) => { e.preventDefault(); // get the value of the input const emailVal = email.value;

let validateEmail = () => { let filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/; // if not correct add error class and remove correct class if (!filter.test(emailVal)) { form.classList.add("form-error"); form.classList.remove("form-correct"); // if correct add correct class and remove error class } else { form.classList.remove("form-error"); form.classList.add("form-correct"); } }; validateEmail(); });

2
Adler G Luders• 1,580

@adluders

Posted

What you mean by not being able to add the js. Is it that you're not understanding what's required or is it that you understand what's expected but not how to do it?

2

Shahin• 95

@Shahinthecoder

Posted

@adluders I do not know how to do it. Checked StackOverflow but could not get a grasp on it.

1
Adler G Luders• 1,580

@adluders

Posted

@Shahinthecoder sorry for the delayed response, it seems that the comment below should suffice.

0

Please log in to post a comment

Log in with GitHub
Discord logo

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