jQuery Datepicker with multiple options

我的梦境 提交于 2019-12-23 09:07:10

问题


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 %>
});

Here's the output:

$(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']
        });
});

回答1:


Can you try doing:

$('#<%= 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

Hope it will be of some help



来源:https://stackoverflow.com/questions/8225111/jquery-datepicker-with-multiple-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!