Translate

Wednesday, June 21, 2017

Jquery DatePicker - How to Reset Date



Sometimes,  when you are working with jquery hiding elements or showing some elements, you might need to reset Datepicker to avoid sending a wrong date.



This code will allow you to reset the date by setting a null value in the date selector



var my_date = $('#my_birthday').datepicker();
$('#btn-clear-date').on('click', function () { my_date.datepicker('setDate', null);
});

No comments:

Post a Comment