如何在文本框中显示日历单击html

时间:2022-11-28 21:10:22

In html i want to show calendar to select date while clicking a text box. then we select a date from that calendar then the selected date will be display in that text box.

在HTML中我想显示日历以选择日期,同时单击文本框。然后我们从该日历中选择一个日期,然后所选日期将显示在该文本框中。

8 个解决方案

#1


19  

Starting with HTML5, <input type="date" /> will do just fine.

从HTML5开始,就可以了。

Demo: http://jsfiddle.net/8N6KH/

#2


5  

You should read-up on jQueryUI Datepicker

您应该阅读jQueryUI Datepicker

Once you include the relevant jQuery UI library, it's as simple as,

一旦你包含了相关的jQuery UI库,它就像,

Script:

$(function() {
    $( "#datepicker" ).datepicker();
});

HTML:

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

Pros:

  • it is thoroughly tested for x-browser compatibility, so you won't have a problem.
  • 它经过了彻底的x-browser兼容性测试,因此您不会遇到任何问题。

  • Separate css file, so you can customize it as per your liking
  • 单独的css文件,因此您可以根据自己的喜好自定义它

#3


3  

try to use jquery-ui

尝试使用jquery-ui

<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>

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

<p>Calendar: <input type="text" id="calendar" /></p>

more

#4


1  

You will need to use any javascript html calendar widget.

您将需要使用任何javascript html日历小部件。

try this calendar view widget, just copy-paste some code shown in example there and thats it what you want.

尝试这个日历视图小部件,只需复制粘贴示例中显示的一些代码,这就是你想要的。

Here is the link to Jquery Mobile date box - JQM datebox

这是Jquery Mobile日期框的链接 - JQM日期框

#5


1  

What you need is a jQuery UI Datepicker

你需要的是一个jQuery UI Datepicker

Check out the demo and the source code.

查看演示和源代码。

#6


1  

yeah you will come across of various issues using HTML5 datepicker, it would work with some or might not be. I faced the same issue. Please check this DatePicker Demo, I solved my problem with this plugin. Its very good and flexible datepicker plugin with complete demo. It is completely compatible with mobile browsers too and can be integrated with jquery mobile too.

是的,你会遇到使用HTML5 datepicker的各种问题,它可以使用某些或不适用。我遇到了同样的问题。请检查这个DatePicker演示,我用这个插件解决了我的问题。它非常好,灵活的datepicker插件,完整的演示。它也与移动浏览器完全兼容,也可以与jquery mobile集成。

#7


0  

jQuery Mobile has a datepicker too. Source

jQuery Mobile也有一个日期选择器。资源

Just include the following files,

只需包含以下文件,

  <script src="jQuery.ui.datepicker.js"></script>
  <script src="jquery.ui.datepicker.mobile.js"></script>

#8


0  

HTML Date Picker You can refer this.

HTML日期选择器您可以参考此。

#1


19  

Starting with HTML5, <input type="date" /> will do just fine.

从HTML5开始,就可以了。

Demo: http://jsfiddle.net/8N6KH/

#2


5  

You should read-up on jQueryUI Datepicker

您应该阅读jQueryUI Datepicker

Once you include the relevant jQuery UI library, it's as simple as,

一旦你包含了相关的jQuery UI库,它就像,

Script:

$(function() {
    $( "#datepicker" ).datepicker();
});

HTML:

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

Pros:

  • it is thoroughly tested for x-browser compatibility, so you won't have a problem.
  • 它经过了彻底的x-browser兼容性测试,因此您不会遇到任何问题。

  • Separate css file, so you can customize it as per your liking
  • 单独的css文件,因此您可以根据自己的喜好自定义它

#3


3  

try to use jquery-ui

尝试使用jquery-ui

<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>

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

<p>Calendar: <input type="text" id="calendar" /></p>

more

#4


1  

You will need to use any javascript html calendar widget.

您将需要使用任何javascript html日历小部件。

try this calendar view widget, just copy-paste some code shown in example there and thats it what you want.

尝试这个日历视图小部件,只需复制粘贴示例中显示的一些代码,这就是你想要的。

Here is the link to Jquery Mobile date box - JQM datebox

这是Jquery Mobile日期框的链接 - JQM日期框

#5


1  

What you need is a jQuery UI Datepicker

你需要的是一个jQuery UI Datepicker

Check out the demo and the source code.

查看演示和源代码。

#6


1  

yeah you will come across of various issues using HTML5 datepicker, it would work with some or might not be. I faced the same issue. Please check this DatePicker Demo, I solved my problem with this plugin. Its very good and flexible datepicker plugin with complete demo. It is completely compatible with mobile browsers too and can be integrated with jquery mobile too.

是的,你会遇到使用HTML5 datepicker的各种问题,它可以使用某些或不适用。我遇到了同样的问题。请检查这个DatePicker演示,我用这个插件解决了我的问题。它非常好,灵活的datepicker插件,完整的演示。它也与移动浏览器完全兼容,也可以与jquery mobile集成。

#7


0  

jQuery Mobile has a datepicker too. Source

jQuery Mobile也有一个日期选择器。资源

Just include the following files,

只需包含以下文件,

  <script src="jQuery.ui.datepicker.js"></script>
  <script src="jquery.ui.datepicker.mobile.js"></script>

#8


0  

HTML Date Picker You can refer this.

HTML日期选择器您可以参考此。