具有多个选项的jQuery Datepicker [英] jQuery Datepicker with multiple options

查看:94
本文介绍了具有多个选项的jQuery Datepicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图获得 datepicker 来显示我正在发送的日期名称,但它仍然使用默认值。有什么应该关闭吗?应该使用单个选项语句设置值吗?我在Firebug中没有任何错误。这是我的代码:

I am trying to get datepicker to display the day names I am sending but it still uses default values. Is there something that should be turned off? Should I set values with single option statements? I don't get any errors in Firebug. Here's my code:

$('#<%= txtDate.ClientID %>').datepicker({
    dateFormat: 'dd/mm/yy',
    changeMonth: true,
    changeYear: true,
    yearRange: "-50:+10",
    clickInput: true,
    dayNames: <%= DayNames %> ,
    dayNamesMin: <%= DayNamesMin %> ,
    monthNames: <%= MonthNames %> ,
    montNamesShort: <%=MonthNamesShort %>
});

以下是输出:

$(document).ready(function () {
    $('#ctl00_ctl00_ctl00_body_body_CenterColumn_CvPersonalInfoControl_birthDate_txtDate').datepicker({
            dateFormat: 'dd/mm/yy',
            changeMonth: true,
            changeYear: true,
            yearRange: "-50:+10",
            clickInput: true,
            dayNames: ['Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi', 'Pazar'] ,
            dayNamesMin: ['Pzt', 'Sa', 'Çrş', 'Prş', 'Cu', 'Cmt', 'Pzr'] ,
            monthNames: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'] ,
            monthNamesShort: ['Ock', 'Şbt', 'Mrt', 'Nsn', 'Mys', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Ekm', 'Kas', 'Ara']
        });
});


推荐答案

你可以尝试做:


$('#<%= txtDate.ClientID %>').datepicker({
    dateFormat: 'DD/mm/yy',
    changeMonth: true,
    changeYear: true,
    yearRange: "-50:+10",
    clickInput: true,
    dayNames: <%= DayNames %> ,    
    monthNames: <%= MonthNames %> ,
    monthNamesShort: <%=MonthNamesShort %>
});
//the DD - day name long 
check the ref: http://docs.jquery.com/UI/Datepicker/formatDate

希望会有所帮助。

这篇关于具有多个选项的jQuery Datepicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆