Link to home
Start Free TrialLog in
Avatar of Jon Imms
Jon ImmsFlag for United States of America

asked on

Uncaught TypeError: $ is not a function

Getting the following error in my js script. :  Uncaught TypeError: $ is not a function

$(document).ready(function() {
    setTimeout(function() {
      $('#data-ad-popup').modal('show');
    }, 10000); // milliseconds. set to 10 seconds.
});

Open in new window


Not sure how to fix it?
Avatar of zc2
zc2
Flag of United States of America image

Make sure the jQuery library is loaded.
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
$ => jQuery.

For jQuery to work it must be included on your page with a <script> tag

<script src="... path to jQuery file "></script>

Open in new window


1. The <script> must be BEFORE the use of $(...
2. Ensure that jQuery has not been set to compatibility mode try
jQuery(function($) {
  // continue to use $ here (jQuery also works but $ is easier and fits in with common use case)
});

Open in new window