Topic: input type="date" turns into input type="text" when not focused
ActaDennis free asked 3 years ago
Expected behavior input type="date" should remain input type="date"
Actual behavior input type="date" turns into input type="text" when not focused
Resources (screenshots, code snippets etc.)
<div class="row mb-3"> <div class="col-md-3"> <input type="date" name="data" class="form-control mb-0" value="<?php echo date('Y-m-d');?>" required /> <small class="text-muted">Data Atto</small> </div> <div class="col-md-9"> <select class="form-control mb-0" name="tipo_atto" required> <option hidden value="">Seleziona tipo atto</option> <option value="atto1">Atto 1</option> </select> <small class="text-muted">Tipo Atto</small> </div> </div>
I think there's some js function in mdb.min.js that does this thing, but for some input dates it works normally, no rewriting. I can't understand what's triggering this effect and why it happens only for some input dates, but I can't figure it out.
In mdb.js file you can find ChangeDateInputType function - this is the one responsible for changing the text / date type. You can remove it from js file.
It was intentional. In the case of data inputs there was a problem with placeholder styling. Some users reported this as a problem and need for improvement.
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.14.1
- Device: Laptop
- Browser: Chrome
- OS: Windows 10
- Provided sample code: No
- Provided link: No