We have on text filed input type date .So we need placedholder so we tried like this
<input placeholder="Date" class="textbox-n" type="text" onfocus="(this.type='date')" id="date">
Now it's showing placehoder "Date".Then i press it's showing mm/dd/yyyy
.Then click it's showing Date box.But no need show mm/dd/yyyy
.After click on textField directly open date box .Please guide to us.
* 'mm/dd/yyyy' value and when valid to show the users' date of birth value. There's no way to have placeholder text on input date elements, so here's a hack for it!
How to set placeholder value for input type date in HTML 5 ? The placeholder attribute does not work with the input type Date, so place any value as a placeholder in the input type Date. You can use the onfocus=” (this.type=’date’) inside the input filed.
But the right field is normal text input filed. Example 2: When you lose the focus on the date the date field changes back to a text field. As we can see, we can modify the placeholder text as needed.
You can use the onfocus=” (this.type=’date’) inside the input filed. Because you are required to have a custom placeholder value for input type “date”, and you have a drop-down calendar where the user can select the date from.
As described in the previous discussions, you can not set the value to blank for JavaScript Date object. For more information refer to :How to initialize java.util.date to empty
However,you can set the default values to a valid date. Refer to How to set date value for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With