设置Input标签Date默认值为当前时间

 1 <input type="date" id="date_info" placeholder="请输入时间"/>
 2  
 3 ......
 4  
 5 <script>
 6     $(document).ready(function () {
 7         var time = new Date();
 8         var day = ("0" + time.getDate()).slice(-2);
 9         var month = ("0" + (time.getMonth() + 1)).slice(-2);
10         var today = time.getFullYear() + "-" + (month) + "-" + (day);
11         $('#date_info').val(today);
12     })
13 </script>

posted on 2020-08-19 20:21  dearroy  阅读(2241)  评论(0编辑  收藏  举报

导航