Jquery DatePicker工具提示格式

时间:2011-09-28 05:08:11

标签: jquery jquery-ui-datepicker

这是我的查询我需要所有日子的工具提示,例如:当鼠标移动到sep / 27/2011时。应显示的工具提示应显示为“2011年9月27日星期二”。如何实现这个?。这是我的jquery datepicker

<script type="text/javascript">
 $(function() {
        $( "#<%= this.txtFrom.ClientID %>" ).datepicker({
            showOn: 'both',
            buttonImage: "Images/calendar.gif",
            buttonImageOnly: true,
            showmonth:true,
            autoSize: true,
            changeMonth: true,
            changeYear: true,
            showAnim: 'slideDown',
            buttonText: "",
            duration: 'fast',
           showOtherMonths: true,
           selectOtherMonths: true
                });
        $(".ui-datepicker-trigger").mouseover(function() {
    $(this).css('cursor', 'pointer');
});
    });
</script

&GT;

最后我找到了解决方案:

          beforeShowDay: function(date) { return [true, '', $.datepicker.formatDate('DD, MM d, yy', date)]; },

然后 // otheroptions

1 个答案:

答案 0 :(得分:0)

认为你需要在onSelect方法上使用它:

$( "#<%= this.txtFrom.ClientID %>" ).datepicker({ 
    showOn: 'both',
    buttonImage: "Images/calendar.gif",
    buttonImageOnly: true,
    showmonth:true,
    autoSize: true,
    changeMonth: true,
    changeYear: true,
    showAnim: 'slideDown',
    buttonText: "",
    duration: 'fast',
    showOtherMonths: true,
    selectOtherMonths: true,
    // all your other options above.
    onSelect: function(dateText, inst) {
        var d = new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay),
            format = $.datepicker.formatDate( 'DD, d MM, yy', d ) 
        this.alt = format; //You may want to use title instead of alt, depending on what element you are using.
    }
});

我使用此示例中的alt文本为您提供输入

的格式

直播示例:http://jsbin.com/eliwut/