Topic: Datepicker how to clear/reset via code?
BigMonkey pro asked 3 years ago
How do you reset the Datepicker back to default state? If I set a date and then want to clear it via code I can set the value which clears the date field but if I then re-open the picker it still has the previous date highlighted.
I tried calling handleClear() which throws an exception and clearButton is null so can't trigger a click.
Dawid Wajszczuk staff answered 3 years ago
Hi,
You can try to reset the form, then dispose the datepicker and re-initialize it. Here is the snippet https://mdbootstrap.com/snippets/standard/d-wajszczuk/3590051.
Keep coding,
Dawid
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Pro
- Premium support: No
- Technology: MDB Standard
- MDB Version: MDB5 3.10.0
- Device: Desktop
- Browser: FF
- OS: Win 7
- Provided sample code: No
- Provided link: No