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

Sign up form

@A-shir1

Desktop design screenshot for the Intro component with sign-up form coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Community feedback

Bonrey 1,130

@Bonrey

Posted

Hello! 👋 In order to change placeholder color, you should add to your input tag the following class:

input.custom-placeholder::placeholder {
  color: red;
}

And then, every time the input is invalid, you should toggle this class in JS like so:

inputField = document.querySelector("your input field");
...
if (invalid input) {
  inputField.classList.add("custom-placeholder");
}
...

To reset the placeholder color, just remove the class:

inputField.classList.remove("custom-placeholder");

And of course, don't forget to set the default placeholder styles in css:

input.default::placeholder {
/* something like this */
    color: gray;
    opacity: 0.5;
}

Good luck! 😉

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