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

Help! Base apparel coming soon.

Ali• 170

@alisbai

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


My email verification js code is not working properly.

I have a class EmailVerification and an instance of it emailInput. My verify method throws an error: Uncaught TypeError: Cannot read properties of undefined (reading 'classList') at HTMLInputElement.verify.

Thank you for taking the time to help me out :)

Community feedback

Darko• 980

@dtomicic

Posted

I've done it by simply making a function which takes email as a parameter and called it in on click of a button to check if the entered email is correctly written if not it displays an error message.

I've checked your code it looks a bit complicated to be honest, you can just make it a function, make a variable with email regex and check in the function if the entered email matches the format and if not display the error message.

It might be a little outdated solution but it'll get you started and you can work on it from there.

0

Ali• 170

@alisbai

Posted

@dtomicic thank u for the idea, I will create a second is file for email validation with this method. I appreciate your feedback

0
P
Vander Santos• 1,750

@vanderms

Posted

Well done!

About your undefined problem, in JavaScript is not always very clear what is this when you are using a method. In your case, the this in this.iconError is the input element, which is the target of the event listener.

Try changing this line:

this.DOMInput.addEventListener(eventType, this.verify);

for:

this.DOMInput.addEventListener(eventType, () => this.verify());

0

Ali• 170

@alisbai

Posted

@vanderms Thank you so much this is so helpful. I was struggling with this the whole morning. I appreciate the help :)

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