输入类型日期无法正常工作。 [英] Input Type Date is not working properly.

查看:60
本文介绍了输入类型日期无法正常工作。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的一个html5表单中使用输入类型日期。



当我点击它打开datepicker窗口时,如果我选择日期,那么它应该选择日期并关闭该datepicker窗口。但它没有关闭那个窗口。



请帮帮我。

I am using input type date in one of my html5 form.

When i click on that it opens datepicker window and if i select date then it should select the date and close that datepicker window. But it not closing that window.

Please help me out.

推荐答案

日期输入类型的规格不够用细节决定了这种行为,所以它可能在不同的浏览器中有所不同。



JQuery datepicker做你想要的并且是一致的在浏览器中,也许您可​​以使用它。



http://jqueryui.com / datepicker / [ ^ ]



希望这会有所帮助,

Fredrik
The spec for the date input type does not go into enough detail to dictate that sort of behavior so it's likely to be different across different browsers.

The JQuery datepicker does what you want and is consistent across browsers, maybe you can use that instead.

http://jqueryui.com/datepicker/[^]

Hope this helps,
Fredrik


您好,



以下是您可以使用的代码片段



< input type =dateid =birthDatename =birthDate value =出生日期/>

Hi,

Here is the code snippet you can make use of

<input type="date" id="birthDate" name="birthDate" value="Birth Date" />
<script type="text/javascript">
var dt = document.getElementById('birthDate');
if (dt) dt.onchange = function () {
   dt.setAttribute('type', 'text');
   dt.setAttribute('type', 'date');
}
</script>



这只是一个技巧,所以不要完全依赖它,因为它可能无法从代码审查中逃脱我认为



但我总是喜欢使用Jquery。


Its Just a trick,so do not fully rely on it because it might not escape from Code review I think

But I would always prefer to use Jquery for it.


(< span class =code-sdkkeyword> document )。ready( function (){
(document).ready(function (){


这篇关于输入类型日期无法正常工作。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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