0

I want to show the placeholder of date input as yyyy-mm-dd but it is not working.

from this and this I changed my input type to text then added onfocus method to change it to date, but when I click on the field and it changes to date format, the placeholder is still in mm/dd/yyyy format. how to make the placeholder works?

Here is my code:

<input  
    type = 'text'
    placeholder="yyyy-mm-dd"
    onfocus="(this.type='date', this.placeholder='yyyy-mm-dd')"
    name='when_is_required_date_{{ item.tag }}{{ item.id }}' 
    id='when_is_required_date_{{ item.tag }}{{ item.id }}' 
    {% if item.when_is_required_date %}
            value='{{ item.when_is_required_date|date:"Y-m-d" }}' 
    {% endif %}
    required 
    min="2021-01-31"
    pattern="\d{4}-\d{2}-\d{2}">
Roy
  • 6,063
  • 3
  • 18
  • 43
Shahriar.M
  • 365
  • 2
  • 12

0 Answers0