Topic: Can't clear datepicker
                  
                  balcamo
                  free
                  asked 2 years ago
                
Expected behavior
I am trying to add buttons that clear all elements on a form. I have a reset and exit button that should trigger the event.
Actual behavior
On clear/reset the value is remaining the same. I've tried the common datepicker jquery methods.
Resources (screenshots, code snippets etc.)


                      
                      emmdb
                      priority
                        answered 1 year ago
                    
Please resolve it, it has now become a headache
Mateusz Lazaru staff commented 1 year ago
If you need a clear-form-btn, try to create a handleClear() function. Inside the function you'll need to change the state of the picker's value prop.
I haven't checked it in older versions, but in MDB React 9.0.0 it should work just fine.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
 - Premium support: No
 - Technology: MDB React
 - MDB Version: MDB5 5.1.0
 - Device: PC
 - Browser: Chrome
 - OS: Windows
 - Provided sample code: No
 - Provided link: No
 
Grzegorz Bujański free commented 2 years ago
What do you mean by common datepicker jquery methods? Can you paste here the code that executes when you click the clear button?
balcamo free commented 2 years ago
$('.datepicker').datepicker('setDate', '') $('.datepicker).attr('value', '')