Recommand · June 11, 2021 0

how to change color of the placeholder of date input html tag?

I already know how to change the placeholder value’s color, but the same is not possible with the date input tag, please tell me how to do so,

<input type="date" />

This has to be done with JavaScript.

document.querySelector('input').onchange=function(){
  this.style.color="black";
}
<input type="date" style="color:red" />

<!DOCTYPE html>
<html>
<head>
<title>Change Placeholder Color</title>
</head>
<style>
::placeholder { /* Firefox, Chrome, Opera */
    color: blue;
}
  
:-ms-input-placeholder { /* Internet Explorer 10-11 */
    color: red;
}
  
::-ms-input-placeholder { /* Microsoft Edge */
    color: orange;
}
</style>
<body>
    <p>Change Placeholder Color</p>
    <input type="text" placeholder="Enter your Text">
</body>
</html>

You can check here: https://www.geeksforgeeks.org/change-an-html5-input-placeholder-color-with-css/