Back to ProEvents Support

thiago33406
thiago33406

Plugin Version 3.1.3

Using the responsive style of the calendar I was getting the following console error: Uncaught ReferenceError: $ is not defined

The error doesn't seem to affect the calendar (tooltips where showing up, event links where working, etc).

Wrapping the script tag in a {% put scripts %} clears the console error. Not sure if this is related to our custom theme. Sorry to post this here but I couldn't find the GitHub repo to open a PR.

octobercms/plugins/radiantweb/proevents/components/eventcalendar/responsive_ajax.htm

{% put scripts %}
    <script type="text/javascript">
    $(document).ready(function(){
        setToolTips();
        equalHeights(130,600);
    });
    </script>
{% endput %}
ChadStrat
ChadStrat

you need your theme to include jQuery. Sometimes included in the footer rather than the header may be required depending on race conditions.

hlipperjohn57772
hlipperjohn57772

Basically $ is an alias of jQuery() so when you try to call/access it before declaring the function, it will endup throwing this $ is not defined error . This usually indicates that jQuery is not loaded and JavaScript does not recognize the $. Even with $(document).ready , $ is still going to be undefined because jquery hasn't loaded yet.

To solve this error:

Load the jQuery library at the beginning of all your javascript files/scripts which uses $ or jQuery, so that $ can be identified in scripts .

There can be multiple other reasons for this issue:

  • Path to jQuery library you included is not correct
  • The jQuery library file is corrupted
  • Working offline
  • Conflict with Other Libraries

1-3 of 3