0

I want to stop autoslider in flexslider module.I caught

undefined TypeError:$ is not a function

jQuery(window).load(function($) {
    $('#testvideo').flexslider({ //undefined TypeError:$ is not a function
        slideshow: false
    });
});

How to fix the error

Carsten Løvbo Andersen
  • 26,637
  • 10
  • 47
  • 77
user3386779
  • 6,883
  • 20
  • 66
  • 134

1 Answers1

2

The reference to jQuery - the $ function in this case - is not passed as a parameter. The function gets the event object instead. By specifying it in the parameters list, you're overwriting it. There are multiple avenues to fix this.

If you're not using noConflict, it can be easily fixed by removing $ from the function's definition: jQuery(window).load(function() {. If you do, then you can either use jQuery() instead of $ as such

jQuery(window).load(function(event) {
jQuery('#testvideo').flexslider({ //undefined TypeError:$ is not a function
   slideshow: false
 });
});

or wrap everything in a IIFE:

(function($) {
    $(window).load(function() {
    $('#testvideo').flexslider({ //undefined TypeError:$ is not a function
       slideshow: false
     });
    });
})(window.jQuery);
motanelu
  • 3,945
  • 1
  • 14
  • 21