Faris Pβ’ 2,810
@FarisPalayi
Posted
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