Uncaught TypeError: $(...).fullCalendar is not a function in Laravel 5

2.5k views Asked by At

I'm trying to display the full calendar on my Laravel project but it seems my scripts aren't loading correctly.

I currently have everything hardcoded:

@extends('masterpage')
<link rel='stylesheet' href='{{ asset('/css/fullcalendar.css') }}' />
<script src='{{ asset('/js/jquery.min.js') }}'></script>
<script src='{{ asset('/js/moment.min.js') }}'></script>
<script src='{{ asset('/js/fullcalendar.js') }}'></script>
<style>

    body {
        margin: 40px 10px;
        padding: 0;
        font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
        font-size: 14px;
    }

    #calendar {
        max-width: 900px;
        margin: 0 auto;
    }

</style>

@section('content')
<h1> Calendar </h1>
<div id='calendar'></div>
@stop

@section('footer')
<script>

    $(document).ready(function() {

        $('#calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,basicWeek,basicDay'
            },
            defaultDate: '2015-02-12',
            editable: true,
            eventLimit: true, // allow "more" link when too many events
            events: [
                {
                    title: 'All Day Event',
                    start: '2015-02-01'
                },
                {
                    title: 'Long Event',
                    start: '2015-02-07',
                    end: '2015-02-10'
                },
                {
                    id: 999,
                    title: 'Repeating Event',
                    start: '2015-02-09T16:00:00'
                },
                {
                    id: 999,
                    title: 'Repeating Event',
                    start: '2015-02-16T16:00:00'
                },
                {
                    title: 'Conference',
                    start: '2015-02-11',
                    end: '2015-02-13'
                },
                {
                    title: 'Meeting',
                    start: '2015-02-12T10:30:00',
                    end: '2015-02-12T12:30:00'
                },
                {
                    title: 'Lunch',
                    start: '2015-02-12T12:00:00'
                },
                {
                    title: 'Meeting',
                    start: '2015-02-12T14:30:00'
                },
                {
                    title: 'Happy Hour',
                    start: '2015-02-12T17:30:00'
                },
                {
                    title: 'Dinner',
                    start: '2015-02-12T20:00:00'
                },
                {
                    title: 'Birthday Party',
                    start: '2015-02-13T07:00:00'
                },
                {
                    title: 'Click for Google',
                    url: 'http://google.com/',
                    start: '2015-02-28'
                }
            ]
        });

    });

</script>
@stop

My js and css are located in my public folder and therefor I'm using the short tag to link them.

Anyone have an idea what I'm doing wrong?

1

There are 1 answers

0
Borni On

Ok, so I figured it out! Seems like I was also pulling in a second jquery script on my master page For anyone who ever has this problem, just make sure you're not doing any double code cause that will mess it up too!