如何更改月份名称 DatePicker(日历)

How to change month name DatePicker (calendar)

我有一个日期选择器实例,我希望能够更改月份名称。我该怎么做?

我试过了,但我不确定我做错了什么。

我的尝试:

<script>
    $(function() {
        $( "#datepicker" ).datepicker({
            altField: "#alternate",
        });
    });

    $( ".selector" ).datepicker({
        monthNames: [ "Test1", "Test2", "Test3", "Test4", "Test5", "Test6",
                      "Test7", "Test8", "Test9", "Test10", "Test11", "Test12" ]
    });
    var monthNames = $( ".selector" ).datepicker( "option", "monthNames" );
    $( ".selector" ).datepicker( "option", "monthNames", 
        [ "Test1", "Test2", "Test3", "Test4", "Test5", "Test6", 
          "Test7", "Test8", "Test9", "Test10", "Test11", "Test12" ] );
</script>

datePicker 触发器函数应在 document.ready() 内,并将 monthNames: 属性 更改为 monthNamesShort:

<script>
    $(function () {
        $("#datepicker").datepicker({
            altField: "#alternate",
        });

        $(".selector").datepicker({
            monthNamesShort: ["Test1", "Test2", "Test3", "Test4", "Test5", "Test6", "Test7", "Test8", "Test9", "Test10", "Test11", "Test12"]
        });
        var monthNames = $(".selector").datepicker("option", "monthNames");
        $(".selector").datepicker("option", "monthNames", ["Test1", "Test2", "Test3", "Test4", "Test5", "Test6", "Test7", "Test8", "Test9", "Test10", "Test11", "Test12"]);
    });
    </script>