我正在尝试使用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中的奇怪行为
发布评论