试一试下面的代码:
<script language="javascript" type="text/javascript">
$().ready(function () {
$("#datepicker").datepicker(
{
currentText: "今天",
todayBtn: false,
dateFormat: "yy-mm-dd",
changeMonth: true,
changeYear: true,
showButtonPanel: true,
showOtherMonths: true,
selectOtherMonths: true
});
$.datepicker._gotoToday = function (id) {
$(id).datepicker('setDate', new Date()).datepicker('hide').blur();
};
})
</script>
_gotoToday是一个未公开的event, 具体参考:
Today button in jQuery Datepicker doesn't work