jquery datepicker does not show the second time

岁酱吖の 提交于 2019-12-12 05:27:52

问题


I use J query date picker to pick the dates in a text field. once i select the date and click again on the same input field it does not show the date picker and once i click somewhere outside the text filed and click on the text field again it works.

$(selector).datepicker({
      minDate: new Date(), 
      dateFormat: 'dd/mm/yy' 
 });

Somebody help me


回答1:


I really did not understand why the Date picker box is not being shown after i select the date and click again to change it without clicking somewhere else on the page.

But i resolved it writing

$(selector).datepicker('show');



回答2:


I think the problem is that the showOn property for the datepicker by default is focus. This means that the datepicker is only triggered when the associated input fields receives the focus. When you use the datepicker to select a date, I assume the input field will still have the focus afterwards and therefore not "receive" it again when clicking into it. You have to click outside the input field and then into it to trigger the focus event (again).

Another option might be to use a button (showOn: button or showOn: both) so you can click on that button to trigger the datepicker.



来源:https://stackoverflow.com/questions/13494926/jquery-datepicker-does-not-show-the-second-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!