开始使用 jquery 日期选择器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15544984/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
getting started with jquery datepicker
提问by Blaze Tama
Im learning web programming and now i stuck with jquery datepicker. I need a full example/tutorial that consist of step-by-stepguide how to :
我正在学习网络编程,现在我坚持使用 jquery datepicker。我需要一个完整的示例/教程,其中包含如何执行以下操作的分步指南:
- Display the jquery datepicker
- Use it
- Get the user input
- 显示 jquery 日期选择器
- 用它
- 获取用户输入
I have done many searching but all i get is the tutorials about "how to modifiy it(with css)". I need a more beginner-friendly tutorial (im just getting started with jquery
and AJAX
, but i know standard javascript
).
我已经做了很多搜索,但我得到的只是关于“如何修改它(使用 css)”的教程。我需要一个更适合初学者的教程(我刚刚开始使用jquery
and AJAX
,但我知道标准javascript
)。
Thanks for your help :D
感谢您的帮助:D
回答by Darren
You need an input field and then add the jQuery
datepicker to it by calling the datepicker
method:
您需要一个输入字段,然后jQuery
通过调用该datepicker
方法向其中添加日期选择器:
<input type="text" id="datepicker" />
<script>
$(function() {
$("#datepicker").datepicker();
});
</script>
$(function() { }indicates that it will call the datepicker
method and attach it to the HTML input control datepicker
once the DOM
has loaded.
$(function() { }表示它会在加载后调用该datepicker
方法并将其附加到 HTML 输入控件。datepicker
DOM