材质datepicker中的奇怪行为

编程入门 行业动态 更新时间:2024-10-27 20:36:23
本文介绍了材质datepicker中的奇怪行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用Google的实用日期选择器( materializecss/forms.html)。这样,当我点击一个图标时,我想弹出日期选择器。我已经实现了两个实现,两者之间的唯一区别是使用代码将 alert('clicked')。

I'm trying to use google's materialize date picker (materializecss/forms.html). With that, I want to popup the date picker when I click on an icon. I have implemented two implementations where the only difference between the two is putting an alert('clicked') with the code.

没有 alert('clicked') : jsfiddle/1bnnkhbw/

alert('clicked') : http: //jsfiddle/1bnnkhbw/1/

第二个工作,而第一个没有..(在chrome)! !!

有人知道这个行为的原因吗?

Anybody knows the reason for this behavior?

还有一种使第一个工作的方法?

And a way to make the 1st one work?

推荐答案

我想我找到一个解决方案,你们检查一下:

I think I found a solution for you man check this out:

<i id="icon">click</i> <input class="datepicker" style="display:none;" value="click"></input> $('.datepicker').pickadate({ selectMonths: true, selectYears: 15 }); $('#icon').click(function(event){ event.stopPropagation(); $(".datepicker").first().pickadate("picker").open(); console.log("test1"); });

小提琴: jsfiddle/k2qtzp7p/1/

从这里和这里

更多推荐

材质datepicker中的奇怪行为

本文发布于:2023-10-14 11:33:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1490953.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:材质   奇怪   datepicker

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!