使用type=date的时候input框中不显示空白
1、当使用type=date的时候默认的在手机上是空白,在电脑上面也没有显示日期

3、js代码:var no嘛术铹砾w = new Date();//alert(now.getDate()+'-'+now.getMonth烫喇霰嘴());//格式化日,如果小于9,前面补0var day = ("0" + now.getDate()).slice(-2);//格式化月,如果小于9,前面补0var month = ("0" + (now.getMonth() + 1)).slice(-2);//拼装完整日期格式var today = now.getFullYear()+"-"+(month)+"-"+(day) ;//完成赋值$('#createStartTime').val(today);

5、这样在电脑和手机上面都有日期了。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:29
阅读量:50
阅读量:67
阅读量:46
阅读量:54