jQuery datepicker不显示第二次 [英] jquery datepicker does not show the second time

查看:88
本文介绍了jQuery datepicker不显示第二次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用J查询日期选择器在文本字段中选择日期.一旦我选择了日期并再次单击相同的输入字段,它就不会显示日期选择器,并且一旦我在提交的文本之外的某个地方单击并再次单击文本字段,它就会起作用.

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' 
 });

有人帮助我

推荐答案

我认为问题在于日期选择器的showOn属性默认情况下为focus.这意味着仅当相关输入字段获得焦点时,才会触发日期选择器.当您使用日期选择器选择日期时,我假设输入字段之后仍将具有焦点,因此在单击它时不会再次接收"它.您必须在输入字段之外单击,然后再进入该字段以触发focus事件(再次).

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).

另一种选择是使用按钮(showOn: buttonshowOn: both),以便您可以单击该按钮来触发日期选择器.

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

这篇关于jQuery datepicker不显示第二次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆