在输入类型中设置格式和值=“日期” [英] Setting format and value in input type="date"

查看:111
本文介绍了在输入类型中设置格式和值=“日期”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法设置< input type =date/> 的格式?如果没有,那么我该如何在默认格式 type =date中使用JavaScript来在此字段中设置日期。我怎样才能得到这个领域的格式?

编辑:
实际上我想显示移动设备的本机日期选择器,这就是为什么我选择了这种类型的输入。如果这个领域有任何替代品,那也是一件好事。



对不起,如果我说什么愚蠢的话。请指导

解决方案

格式为 YYYY-MM-DD 。你不能改变它。



$('#myinput')。val('2013-12-31'); 设置值


Is there any way to set the format of <input type="date" /> ? if no then how can i set date in this field using JavaScript in the default format of type="date". how can i get what will be the format of this field?

EDIT : Actually i want to show native date-picker of mobile device that's why i picked this type of input. if is there any alternate for that field that also will b good to have.

Sorry if i said anything stupid. Please guide me

解决方案

The format is YYYY-MM-DD. You cannot change it.

$('#myinput').val('2013-12-31'); sets value

这篇关于在输入类型中设置格式和值=“日期”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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