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

News-letter-signup with js

0sereme 370

@Dev-simeon-tech

Desktop design screenshot for the Newsletter sign-up form with success message coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Community feedback

ERIC 580

@ricoom

Posted

Hello @Osereme congratulations on completing this challenge. I have some few observations that I believe may help you improve your code. 1.make use of the JavaScript Validation API to avoid reinventing the wheel and get the best from html5. the API has methods that enable you to not only check for input errors but also give you ready messages to display to client. you can achieve this by adding a span to the input. input.checkValidtiy() is one of the useFul methods that come in handy in this challenge. eg.

submit.addEventListener('click',(e)=>{ e.preventDefault();

if(input.checkValidity()){

   // some code
}else{

//display error err.innerText=input.validationMessage; }

})

2.mark the email input as required to avoid creating hardcoded not-null message. I hope you find these observation helpful. happy coding 😉

Marked as helpful

0

0sereme 370

@Dev-simeon-tech

Posted

Hello @ricoom thanks for the advice on the API and required input attribute i will work on it.

1

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