I have a Drupal site with a purchased theme - see it here.
The theme includes jQuery 2.x and Bootstrap in the <head>
section of the page, but trying to access the $
variable gives Uncaught TypeError: $ is not a function
Drupal stores jQuery in a variable called jQuery
(using jQuery's noConflict
mode - see drupal.js
) rather than $
to avoid conflicts with other libraries like Prototype.
// Allow other JavaScript libraries to use $.
jQuery.noConflict();
You can just do:
jQuery(document).ready(function($){
// normal jQuery stuff here
$.whatever
});