Design comparison
SolutionDesign
Solution retrospective
PLEASE PROVIDE SOME FEEDbACK ON MY JAVASCRIPT... IT WILL bE VERY HELPFUL TO HAVE YOUR INSIGHTS... AND PLEASE SUGGEST ME A WAY TO CHANGE THE COLOR OF THE PLACEHOLDER WHN AN ERROR IN THE EMAIL OCCURS...
Community feedback
- @FarisPalayiPosted over 3 years ago
You can use the
::placeholder
CSS pseudo-element to change the color of a placeholder in CSS::-webkit-input-placeholder { color: red } // ๐for webkit browsers like chrome ::placeholder { color: red }
Since you can't really select pseudo-elements using JavaScript, create a class. Like this:
.placeholder-error::-webkit-input-placeholder { color: red }
Then, using JavaScript:
email.classList("placeholder-error")
Hope it helps๐
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