设置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>

你可能感兴趣的:(设置Input标签Date默认值为当前时间)