How to clear DatePicker

I have a DatePicker for choosing a birthday.

This will be used for some filtering, and after filtering I will need the value to be reset, i.e. DatePicker must be empty.

Any help ???

+5
source share
2 answers

If you want to clear the TextField from DatePicker , you can use:

 datepicker.getEditor().clear(); 

If you want to clear the value and text field, use:

 datePicker.setValue(null); 
+17
source

just add this code

 }).keyup(function(e) { if(e.keyCode == 8 || e.keyCode == 46) { $.datepicker._clearDate(this); } }); 

You can use backspace to clear the field, even if it has a read-only mode. A source

-1
source

Source: https://habr.com/ru/post/1203088/


All Articles