aleegu
aleegu

Reputation: 1

$ is not defined with jQuery

When I use the jQuery.js, it says that $ is not defined. Following is my code, and I have tried the solutions, like adding the tag for jQuery first in HTML, change the logic of my code. However none of them work for me.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="js/bootstrap/bootstrap.min.js"></script>
<script src="js/wow/wow.min.js"></script><script>new WOW().init();</script>
<srcipt src="js/manific-popup/jquery.magnific-popup.min.js"></srcipt>
<script src="js/custom.js"></script>

custom.js

$(function(){
  $("#work").magnificPopup({
    delegate: 'a',
    type: 'image'
  });
});

Upvotes: 0

Views: 94

Answers (2)

Ali Sheikhpour
Ali Sheikhpour

Reputation: 11045

Checklist for $ is not defined:

  1. Open the console and check if Jquery file is loaded. The file may not be available due to slow connection, proxy setting, firewall setting etc.
  2. Make sure that the Jquery file is not edited (not applicable when using CDN).
  3. Make sure that you don't include Jquery twice. You may have use a custom version of bootstrap or other plugins that contains another version of Jquery inside their codes.
  4. Make sure that your JS code is not above the Jquery implementation.If you have JS codes which runs as soon as loading (Not after DOM ready etc.), You have to move Jquery implementation in top of your document.
  5. Make sure you have not typed type="text/javascirpt" instead of type="text/javascript". (Not applicable in your case)
  6. View page source and make sure that jquery implementation is not removed by server side codes like response.clear
  7. Make sure your default scripting language is javascript. Otherwise you have to redefine script language by type="text/javascript"

Upvotes: 1

Pritam Banerjee
Pritam Banerjee

Reputation: 18923

$ is not defined can be solved by downloading the full jquery file and not the minified version.

Use this version and make sure that you have added it in your html.

Upvotes: 0

Related Questions