jquery datepicker prevent native click in onSelect

大兔子大兔子 提交于 2019-12-01 16:40:10

问题


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 ?


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/4548908/jquery-datepicker-prevent-native-click-in-onselect

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