简体   繁体   中英

Uncaught TypeError: Cannot call method 'each' of undefined

I have this error while trying to run mediaelement player.

The error is reported at mediaelement-and-player.min.js:44 .

Edit: My apologies, I posted this from the mediaelementjs.com Support website.

I was trying to use mediaelement.js to play audio on my website.

Edit 8/2: The interesting thing is that when i load the full mediaelement-and-player.js instead of the minified version, it works fine.

I just dealt with this same issue while trying to use the Drupal module, http://drupal.org/project/mediaelement .

Turns out that a core Drupal javascript file, drupal.js, was calling jQuery.noConflict() which removes the $ variable from being defined in the global scope, hence bringing this bug in mediaelement-and-player.js to light.

This was reported in the issue queue for the mediaelement project and it looks like the fix just got committed: https://github.com/johndyer/mediaelement/pull/570

Most likely you have not loaded the jquery library into your script.

You have to reference the library (a js file) from within the header of your page via url. The url can point to a copy pf jquery you keep local or to a public site.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM