Trigger function when date is selected with jQuery UI datepicker

前端 未结 5 2065

How can I trigger onSelect event when I select a selected date on jQuery UI datepicker?

5条回答
  •  臣服心动
    2020-12-04 15:46

    If you are also interested in the case where the user closes the date selection dialog without selecting a date (in my case choosing no date also has meaning) you can bind to the onClose event:

    $('#datePickerElement').datepicker({
             onClose: function (dateText, inst) {
                //you will get here once the user is done "choosing" - in the dateText you will have 
                //the new date or "" if no date has been selected             
          });
    

提交回复
热议问题