从 JQUERY 日期选择器获取价值 [英] Getting value from JQUERY datepicker
问题描述
如果我想通过将 JQUERY UI 日期选择器附加到像 $("div#someID").datepicker()
这样的 DIV 来内联显示 - 我如何访问所选日期?我假设如果它没有绑定到 INPUT
那么它不会与表单一起提交.
If I want to display the JQUERY UI datepicker inline by attaching it to a DIV like $("div#someID").datepicker()
- how do I access the chosen date? I assume if it's not bound to an INPUT
then it won't be submitted with the form.
我想作为后续,如果我需要将它绑定到 INPUT 元素,有没有办法控制日期选择器相对于 INPUT 元素的定位?如果我希望日期选择器出现在元素的上方或侧面而不是下方,我该怎么做?
I guess as a followup, if I need to bind it to an INPUT element, is there a way to control the positioning of the datepicker relative to the INPUT element? If I wanted the datepicker to appear above or to the side of the element rather than below it, how would I do that?
如果这个答案在某个地方真的很明显,请原谅我.
Forgive me if this answer is somewhere really obvious.
推荐答案
如果你想得到用户选择的日期,你可以这样做:
If you want to get the date when the user selects it, you can do this:
$("#datepicker").datepicker({
onSelect: function() {
var dateObject = $(this).datepicker('getDate');
}
});
我不确定您问题的第二部分.但是,您是否尝试过使用样式表和相对定位?
I am not sure about the second part of your question. But, have you tried using style sheets and relative positioning?
这篇关于从 JQUERY 日期选择器获取价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!