开始使用 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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 15:17:22  来源:igfitidea点击:

getting started with jquery datepicker

jquerydatepicker

提问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。我需要一个完整的示例/教程,其中包含如何执行以下操作的分步指南:

  1. Display the jquery datepicker
  2. Use it
  3. Get the user input
  1. 显示 jquery 日期选择器
  2. 用它
  3. 获取用户输入

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 jqueryand AJAX, but i know standard javascript).

我已经做了很多搜索,但我得到的只是关于“如何修改它(使用 css)”的教程。我需要一个更适合初学者的教程(我刚刚开始使用jqueryand AJAX,但我知道标准javascript)。

Thanks for your help :D

感谢您的帮助:D

回答by Darren

You need an input field and then add the jQuerydatepicker to it by calling the datepickermethod:

您需要一个输入字段,然后jQuery通过调用该datepicker方法向其中添加日期选择器:

 <input type="text" id="datepicker" />

 <script>
   $(function() {
     $("#datepicker").datepicker();
   });
 </script>

$(function() { }indicates that it will call the datepickermethod and attach it to the HTML input control datepickeronce the DOMhas loaded.

$(function() { }表示它会在加载后调用该datepicker方法并将其附加到 HTML 输入控件。datepickerDOM

http://jqueryui.com/datepicker/

http://jqueryui.com/datepicker/