jquery datepicker prevent native click in onSelect

2019-02-22 03:17发布

I'm in struggle trying to prevent native click inside jquery datepicker.onSelect event

Example below is not working, click still is being triggered:

onSelect: function(dateText, inst) { 

if (myCondition) {
   return false; 
 }}

Another trick would be calling event.preventDefault/ inside onSelect, if event object has been available.

Any known solutions ?

2条回答
ゆ 、 Hurt°
2楼-- · 2019-02-22 03:35

Perhaps you can achieve this via CSS instead of binding to events?

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-02-22 03:50

What if you used the beforeShow event ? as referenced here http://jqueryui.com/demos/datepicker/#event-beforeShow

This way, you could really prevent the datepicker from being displayed.

Regards,

Max

查看更多
登录 后发表回答