从JQUERY日期选择器获取价值 [英] Getting value from JQUERY datepicker

查看:63
本文介绍了从JQUERY日期选择器获取价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想通过将JQUERY UI datepicker附加到像$("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元素,是否有一种方法可以控制datepicker相对于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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆