I have a datepicker that is on an input field,The default date, when I first open it, is today's date, and that is what I want.However, when I select a date and I clear the input field,the date picker still has the selected date on it, which I donβt want: pDoes anyone have an idea why this is happening and how can I prevent this behavior?
thanks,
J.
See http://codepen.io/alexgill/pen/yOQrwV
$(SELECTOR).datepicker('setDate', null);
The correct way to reset the date of a Datepicker widget is as follows:
$.datepicker._clearDate('#input_field_goes_here');
Or like this:
$('#input_field_goes_here').datepicker('setDate', null);
Which is best for you.
Clear button on calendar.
$("#txtCalendar").datepicker({ showButtonPanel: true, closeText: 'Clear', onClose: function (dateText, obj) { if ($(window.event.srcElement).hasClass('ui-datepicker-close')) $("#txtCalendar").val(''); } });
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
Source: https://habr.com/ru/post/946394/More articles:Sublime text 2 search does not work - sublimetext2bootstrap modal and mmenu clash menu - javascriptWhat is the basic structure of std :: initializer_list? - c ++How to get line number based on a unique field and sort by another field - sql-serverHow to combine Prestashop (PHP) and DjangoCMS (Python) - pythonUsing Amazon S3 as a file system for MongoDB - mongodbWhat is the difference between scipy.ndimage.filters.convolve and scipy.signal.convolve? - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/946397/spring-mvc-binding-complex-objects-to-ui&usg=ALkJrhha4yIeeuwAbN5moedAjqG6QOXe9QHow to change the coordinates of a hike on the fly - ioscompile Java on native Android instead of writing in C - androidAll Articles