I cannot add a placeholder to DateInput widget inside a form if I pass 'type': 'date' to attrs. However, if I don't pass 'type': 'date' to attrs the field behaves like a TextInput.
It looks super simple but I can't understand what's going wrong.
forms.py
class QueryClientsForm(forms.Form):
initial_date = forms.DateField(
widget=forms.widgets.DateInput(
attrs={'placeholder': 'Initial date...', 'type': 'date', }))
query_clients.html
<div class="container h-50">
<div class="row justify-content-center">
<div class="register_card" style="display: inline-block;">
<form method="POST" action="">
{% csrf_token %}
<div class="input-group">
{{form.initial_date}}
<input class="btn login_btn" type="submit" style="margin-left: 10;" value="SEARCH">
</div>
</form>
</div>
</div>
</div>
I tried to use some javascript aswell but it didn't work...
<script>
var initial_date = document.getElementById('id_initial_date')
initial_date.placeholder = 'Initial date...';
</script>
What I've to change?