question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jQuery not found in Drupal 7

See original GitHub issue

Version 3.0.1 doesn’t seem to work with Drupal 7.

The library is included and the javascript files are loaded in the following order:

  1. jquery.js?v=1.7.2 (have also tried 1.6-1.10 versions with no luck)
  2. jquery.once.js?v=1.2
  3. drupal.js
  4. mediaelement-and-player.js?v=3.0.1 . . .
  5. custom_video.js

The content of custom_video.js is very basic, just the usual Drupal structure, an once wrapper to make sure AJAX doesn’t break anything, and a call on the mediaelementplayer() function. (function ($, Drupal) { Drupal.behaviors.neoContentMediaElementJS = { attach: function (context) { $('.neo-mejs-player', context).once('mediaelement-video', function () { $(this).mediaelementplayer(); } }); }); } }; })(jQuery, Drupal);

Mediaelementplayer() gets executed, but stops at the first $ sign on line 3786, with the following error message:

Uncaught TypeError: $ is not a function

If I replace the $ signs with window.jQuery the code works. Am I calling the function in a wrong way, or does mediaelement.js use the window.jQuery in some places by mistake?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rafa8626commented, Jan 25, 2017

You are welcome

0reactions
kovacskricommented, Jan 25, 2017

Thanks for your help, it even works with jQuery 1.7 for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JQuery not defined error | Drupal.org
Hi, I have just installed a clean Drupal 7 and also CKEditor. The textareas are not converting to Rich Text ... Error: JQuery...
Read more >
ReferenceError: jQuery is not defined [#2966861] | Drupal.org
Hi, I use version 7.x-1.46 on a Drupal 7.59 installation and I get ReferenceError: jQuery is not defined error from clientside_validation.js ...
Read more >
jQuery is not defined [#2718281] | Drupal.org
Cookie popup appears only on my admin theme, in the main theme I have the error "jQuery is not defined". I use jQuery...
Read more >
jQuery is not defined [#3217346] | Drupal.org
The console shows that the jQUery is not loaded: Uncaught ReferenceError: jQuery is not defined The problem seems to be that in ...
Read more >
Uncaught Reference Error : jQuery is not defined | Drupal.org
When the module is installed the console shows this message: Uncaught Reference Error : jQuery is not defined at drupal.js ?p9aoin:5.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found