设置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 @ 2019-12-24 10:13  xsan  阅读(3064)  评论(0编辑  收藏  举报