问题
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