如何调用/绑定jquery datepicker到标签或div而不是输入字段 [英] How to call/bind a jquery datepicker to a label or div instead of an input field
本文介绍了如何调用/绑定jquery datepicker到标签或div而不是输入字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用此页面上的jqueryui datepicker - http://jqueryui.com/demos/datepicker /
如何在标签上调用它,而不是输入字段?这是可能的吗?
解决方案
我没有看过代码,但我怀疑它假定它附加到一个< input type =text>
元素
所以假设你必须有这个元素。 >
您可以隐藏< input>
,并通过从标签事件调用其方法与datepicker进行交互。 p>
$(labelselector).click(function(){
$(inputselector).datepicker('show');
});
I'm working with the jqueryui datepicker on this page - http://jqueryui.com/demos/datepicker/
How do I call it on a label instead of an input field? Is this possible?
解决方案
I haven't looked at the code but I suspect that it assumes that it's attached to a <input type="text">
element.
So assume that you must have that element.
You can hide the <input>
and interact with the datepicker via calls to its methods from your label events.
$(labelselector).click(function() {
$(inputselector).datepicker('show');
});
这篇关于如何调用/绑定jquery datepicker到标签或div而不是输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文