给input date设置默认值
束福
2023-12-01
// 给input date设置默认值
var now = new Date();
//格式化日,如果小于9,前面补0
var day = ("0" + now.getDate()).slice(-2);
//格式化月,如果小于9,前面补0
var month = ("0" + (now.getMonth() + 1)).slice(-2);
//拼装完整日期格式
var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
//完成赋值
$('#id_yy_input').val(today);