Tri Nguyen
Tri Nguyen

Reputation: 11138

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.

Upvotes: 0

Views: 2954

Answers (2)

teatime
teatime

Reputation: 201

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

Upvotes: 1

arkascha
arkascha

Reputation: 42984

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.

Upvotes: 0

Related Questions