1

enter image description here

There is a html5 datepicker inside my website, the problem is the placeholder is default by the computer locale, but in fact my website support multi-language, e.g. English/ Japanese /etc... so I wonder how can I change the placeholder, and if it is unfeasible , then how can I hide the placeholder?

Thanks for helping

Update: html code (the datepicker is generate by a ContactForm7 plugin in wordpress, but it seems very similar to native html5 one)

<input type="date" name="date" value="" class="wpcf7-form-control wpcf7-date wpcf7-validates-as-date required" min="2015-03-18" aria-invalid="false">
user782104
  • 13,233
  • 55
  • 172
  • 312
  • 1
    Can you post the code for the date picker? Usually there'll be an attribute called `placeholder` – Aswin Ramakrishnan Mar 18 '15 at 01:59
  • 1
    That's not the code for the datepicker. That's just the input field that the datepicker then uses. There's likely a whole lot of JavaScript and that's what we'd need to see to help. – DA. Mar 18 '15 at 02:06
  • Yea.. That isn't the date picker. You should be able to do something like this once the datepicker is created - `$('.datepicker').attr('placeholder', '');` – Aswin Ramakrishnan Mar 18 '15 at 02:09
  • datepicker is jqueryui create one? since the current one seems not create through js – user782104 Mar 18 '15 at 02:11

2 Answers2

0

You can use CSS to change the default placeholder. Check this answer https://stackoverflow.com/a/22020200/909535

Community
  • 1
  • 1
meteor
  • 2,518
  • 4
  • 38
  • 52
  • 1
    You can't change content via CSS. That answer isn't talking about changing the actual placeholder text. – DA. Mar 18 '15 at 02:07
0

This is a somewhat an old question but for anyone facing such issues you can achieve that by doing the following;

Please NOTE: The placeholder attribute does not work with the input type Date. You can use the onfocus=”(this.type=’date’) and the onblur=”(this.type=’text’) inside the input field as a native solution for this shortcoming

<input type="text" placeholder="your custom placeholder"
        onfocus="(this.type='date')"
        onblur="(this.type='text')">