Search code examples
htmlcordovadatepickerplaceholder

Not showing placeholder for input type="date" field


I am doing a phonegap app. When I am trying type="date" input field as shown below, it shows date picker in iPhone as I expected but it doesn't show the placeholder I have given. I found the same issue here in SO, but no solution anywhere.

 <input placeholder="Date" class="textbox-n" type="date" id="date">

Solution

  • It may not be appropriate... but it helped me.

    What I did is start with a text input field, then change the type to a date input when the input is in focus.

    <input
          placeholder="Date"
          class="textbox-n"
          type="text"
          onfocus="(this.type='date')"
          onblur="(this.type='text')"
          id="date" />