public9nf
public9nf

Reputation: 1399

Owl carousel - TypeError: this.$element.attr(...) is undefined

On my wordpress site i use jQuery 1.12.4 together with owl carousel 2.2. When i load an carousel i get the following error:

TypeError: this.$element.attr(...) is undefined

The carousel is not working. jQuery is loadad in the header and owl carousel in the footer. I call owl carousel in a js file which is loadad after the owl carousel js:

jQuery(document).ready(function($) {
    $("#services-slider").owlCarousel();
});

Upvotes: 1

Views: 2058

Answers (2)

Aleksandr Abramov
Aleksandr Abramov

Reputation: 540

Just minute ago have the same problem on Wordpress...

Look:

  1. id="services-slider" - must be only ONE element with id="services-slider" on page
  2. the element id="services-slider" must have class="owl-carousel"

Upvotes: 2

dmitry_stas
dmitry_stas

Reputation: 116

Just add any class to your #services-slider element. For examle

<div id="services-slider" class="owl-carousel">
  ....
</div>

Upvotes: 7

Related Questions