最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Uncaught TypeError: Cannot read property 'regional' of undefined? - Stack Overflow

programmeradmin1浏览0评论

I am using jQuery UI Calender for French Language. But unfortunately I see the below error not sure if I am missing some thing. Please advice.

Uncaught TypeError: Cannot read property 'regional' of undefined

 JS : 
/**
French initialisation for the jQuery UI date picker plugin. 
**/
/* Written by Keith Wood (kbwood{at}iinet.au),
              Stéphane Nahmani ([email protected]),
              Stéphane Raimbault <[email protected]> */
jQuery(function($){
    $.datepicker.regional['fr'] = {
        closeText: 'Fermer',
        prevText: 'Précédent',
        nextText: 'Suivant',
        currentText: 'Aujourd\'hui',
        monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
        'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
        monthNamesShort: ['Janv.','Févr.','Mars','Avril','Mai','Juin',
        'Juil.','Août','Sept.','Oct.','Nov.','Déc.'],
        dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
        dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'],
        dayNamesMin: ['D','L','M','M','J','V','S'],
        weekHeader: 'Sem.',
        dateFormat: 'dd/mm/yy',
        firstDay: 1,
        isRTL: false,
        showMonthAfterYear: false,
        yearSuffix: ''};
    $.datepicker.setDefaults($.datepicker.regional['fr']);
});

Thanks!!

I am using jQuery UI Calender for French Language. But unfortunately I see the below error not sure if I am missing some thing. Please advice.

Uncaught TypeError: Cannot read property 'regional' of undefined

 JS : 
/**
French initialisation for the jQuery UI date picker plugin. 
**/
/* Written by Keith Wood (kbwood{at}iinet..au),
              Stéphane Nahmani ([email protected]),
              Stéphane Raimbault <[email protected]> */
jQuery(function($){
    $.datepicker.regional['fr'] = {
        closeText: 'Fermer',
        prevText: 'Précédent',
        nextText: 'Suivant',
        currentText: 'Aujourd\'hui',
        monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
        'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
        monthNamesShort: ['Janv.','Févr.','Mars','Avril','Mai','Juin',
        'Juil.','Août','Sept.','Oct.','Nov.','Déc.'],
        dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
        dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'],
        dayNamesMin: ['D','L','M','M','J','V','S'],
        weekHeader: 'Sem.',
        dateFormat: 'dd/mm/yy',
        firstDay: 1,
        isRTL: false,
        showMonthAfterYear: false,
        yearSuffix: ''};
    $.datepicker.setDefaults($.datepicker.regional['fr']);
});

Thanks!!

Share Improve this question edited Jun 15, 2019 at 7:25 iDeveloper 1,72524 silver badges50 bronze badges asked Mar 2, 2016 at 9:46 DeveloperDeveloper 1,4373 gold badges23 silver badges48 bronze badges 1
  • 6 That message seems to be telling you that $.datepicker is not defined. Have you included the jQuery UI script on the page? – nnnnnn Commented Mar 2, 2016 at 9:49
Add a ment  | 

2 Answers 2

Reset to default 0

I'm guessing you forgot to include the localisation file:

<script src="https://jquery-ui.googlecode./svn-history/r3982/trunk/ui/i18n/jquery.ui.datepicker-nl.js"></script>

Source :Datepicker jQuery UI ... set language

Be sure to do not use ASYNC on script tags, because will fire this error.

Wrong:

<SCRIPT SRC="/includes/js/jquery/jquery-ui.js" TYPE="text/javascript" ASYNC></SCRIPT>
<SCRIPT SRC="/includes/js/jquery/jquery-datepicker-ptBR.js" TYPE="text/javascript" ASYNC></SCRIPT>

Right:

<SCRIPT SRC="/includes/js/jquery/jquery-ui.js" TYPE="text/javascript"></SCRIPT>
<SCRIPT SRC="/includes/js/jquery/jquery-datepicker-ptBR.js" TYPE="text/javascript"></SCRIPT>
发布评论

评论列表(0)

  1. 暂无评论