I am using this bootstrap-datepicker for my datepicker.(我正在使用这个bootstrap-datepicker作为我的datepicker。)
I'd like the datepicker to choose "today" for start day or default day.(我希望datepicker为开始日或默认日选择“今天”。) I cannot figure out how to set "today" automatically, so I did an inefficient way(我无法弄清楚如何自动设置“今天”,所以我做了一个低效的方式)
HTML:(HTML:)
<input type="text" value ="today();" id="datepicker"/>
JS:(JS:)
$('#datepicker').datepicker();
function today(){
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth() + 1;
var curr_year = d.getFullYear();
document.write(curr_date + "-" + curr_month + "-" + curr_year);
}
Online Sample: http://jsfiddle.net/BXZk2/(在线样本: http : //jsfiddle.net/BXZk2/)
Just looking for an easy solution to make the default day as "TODAY".(只是寻找一个简单的解决方案,使默认日为“今天”。)
Thanks(谢谢)
ask by olo translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…