Jquery datepicker 中的事件冒泡
我有一个弹出菜单,其中包含带有 jquery 日期选择器的表单,问题是当我选择日期时,菜单和日期选择器日历都会关闭。
我尝试在日期选择器的 Select 事件中使用 event.stopPropagation() ,但是我找不到获取“事件”句柄的方法。
另外,我尝试在选择事件结束时返回 false,但再次没有运气。任何帮助将不胜感激。谢谢。
I have a pop menu that contains a form with a jquery datepicker and the issue is that when I make a date selection, both the menu and the datepicker calendar closes.
I tried to use event.stopPropagation() in the Select event for the datepicker, but the I couldn't find a way to get a handle for the "event".
Also, I tried to return false at the end of the select event but again with no luck. Any help will be much appreciated. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了同样的问题,并通过添加准备好的文档来修复它:
技巧是 datepicker 创建一个带有 id ui-datepicker-div 的 div,所以只需停止该容器中的事件冒泡,一切都会正常工作。
来源: http://forum.jquery.com/topic/datepicker-propogates-click - 活动
I was facing same issue and fixed it by adding in document ready:
the trick is that datepicker creates a div with id ui-datepicker-div so just stop event bubbling from that container and everything will work fine.
Source: http://forum.jquery.com/topic/datepicker-propogates-click-events
我通过修改代码解决了这个问题,以便菜单忽略来自日期选择器的任何点击。
I fixed the issue by modifying the code so that the menu ignores any clicks from the datepicker.
我遇到了同样的问题,首先,我也想停止事件气泡,因为,我单击日期选择器,它不起作用,输入类型是文件被触发(在日期选择器下方),它通过设置数据选择器 z 解决它-999 代码的索引
在这里:
datepicker.css('z-index', 999);
这对我有用
i meet the same problem, at first ,i also want to stop event bubble, because, i click date picker, it doesn't work, input type is file is fired(below date picker), it solve it by setting data picker z-index to 999
code is here:
datepicker.css('z-index', 999);
it works for me