我希望能够有一天返回,每次点击一个链接/ div。
<div> 2013-12-12 - clicking on this, goes back in datepicker one day at a time</div>
<div class="datepicker1"></div>
任何想法?
答案 0 :(得分:0)
这是一个包含示例的完整代码:
JS:
var $datepicker = $( "#datepicker" );
$datepicker.datepicker();
var date = new Date();
var newdate = new Date(date);
newdate.setDate(newdate.getDate() - 7);
$datepicker.datepicker('setDate', newdate);
HTML:
<script>
function minus()
{
var $datepicker = $( "#datepicker" );
var date = $datepicker.datepicker('getDate');
var newdate = new Date(date);
newdate.setDate(newdate.getDate() - 1);
$datepicker.datepicker('setDate', newdate);
}
</script>
<input type="text" id="datepicker">
<a href="#" onclick="minus()">minus date</a>
的jsfiddle:
http://jsfiddle.net/epHNZ/295/