al123
al123

Reputation: 569

bxSlider Uncaught TypeError undefined is not a function

am using this jquery but for some reason am getting this error

<!-- jQuery library (served from Google) -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<!-- bxSlider Javascript file -->
<script src="/js/jquery.bxslider.min.js"></script>
<!-- bxSlider CSS file -->
<link rel="stylesheet" href="/css/jquery.bxslider.css" />

      <script type="text/javascript">
      $(document).ready(function () {
          $('.slider1').bxSlider({

Uncaught TypeError: undefined is not a function

              slideWidth: 960,
              maxSlides: 1,
              slideMargin: 0,
              captions: true,
              auto: true,
              autoControls: true
          });
      });
        </script>

anyone had this before or no?

Thanks

Upvotes: 0

Views: 8915

Answers (1)

Tanmay Patel
Tanmay Patel

Reputation: 1810

$(function(){

instead of:

jQuery(document).ready(function($){

Wordpress uses jQuery in noConflict mode by default. You need to reference it using jQuery as the variable name, not $, e.g. use

jQuery(document);

instead of

$(document);

You can easily wrap this up in a self executing function so that $ refers to jQuery again (and avoids polluting the global namespace as well), e.g.

(function ($) {
   $(document);
}(jQuery));

Upvotes: 3

Related Questions