jQuery not found in Drupal 7
See original GitHub issueVersion 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:
- jquery.js?v=1.7.2 (have also tried 1.6-1.10 versions with no luck)
- jquery.once.js?v=1.2
- drupal.js
- mediaelement-and-player.js?v=3.0.1 . . .
- 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:
- Created 7 years ago
- Comments:10 (7 by maintainers)
You are welcome
Thanks for your help, it even works with jQuery 1.7 for me.