FullCalendar TypeError: $(…).fullCalendar is not a function

前端 未结 6 1335
悲哀的现实
悲哀的现实 2020-12-06 04:48

I was trying to put FullCalendar 2.1.1 but it is not working:



        
相关标签:
6条回答
  • 2020-12-06 04:56

    I've solved the problem simply changing order of my scripts. You must be set: moment.min.js after jquery.min.js look this:

    <script src='/js/jquery.min.js'></script>
    <script src='/js/moment.min.js'></script>
    <script src='/js/fullcalendar.min.js'></script>
    
    0 讨论(0)
  • 2020-12-06 05:12

    If using ES6 syntax, just add this at the start of your file:

    import "fullcalendar";
    
    0 讨论(0)
  • 2020-12-06 05:12

    I had the same problem. I used sitemesh and decorators.
    the problem solved when I injected the JS script's links twice both in the decorator and the webpage!
    The order is important too ,use following order :

    <script src="../../resource/bower_components/jquery/dist/jquery.min.js"></script>
    <script src="../../resource/bower_components/jquery-ui/jquery-ui.min.js"></script>
    <script src="../../resource/dist/js/demo.js"></script>
    <script src="../../resource/bower_components/moment/moment.js"></script>
    <script src="../../resource/bower_components/fullcalendar/dist/fullcalendar.min.js"></script>
    
    0 讨论(0)
  • 2020-12-06 05:14

    I think you have problem with js try the below urls it may solve your problems,

    <script src='http://fullcalendar.io/js/fullcalendar-2.1.1/lib/moment.min.js'></script>
    <script src='http://fullcalendar.io/js/fullcalendar-2.1.1/lib/jquery.min.js'></script>
    <script src="http://fullcalendar.io/js/fullcalendar-2.1.1/lib/jquery-ui.custom.min.js"></script>
    <script src='http://fullcalendar.io/js/fullcalendar-2.1.1/fullcalendar.min.js'></script>
    <script>
        $(document).ready(function() {
            $('#calendar').fullCalendar({
                defaultDate: '2014-09-12',
                editable: true,
                eventLimit: true, // allow "more" link when too many events
            });
        });
    </script>
    

    If the above code works then download the js files used in script tag

    0 讨论(0)
  • 2020-12-06 05:18

    For anyone coming across this, there was only one solution working for me. I'm using webpack to compile my scripts and nothing was working for me, no matter what order I had require('fullcalendar') placed in my main.js file.

    I had to downgrade to version 3.4.0. It instantly solved the problem.

    npm install --save fullcalendar@3.4.0
    
    0 讨论(0)
  • 2020-12-06 05:20

    I also had same problem and it was because the HTML jQuery file was loading twice, hence it was giving me error.

    0 讨论(0)
提交回复
热议问题