Travis
Travis

Reputation: 2245

Uncaught TypeError: Object [object Object] has no method 'bxSlider'

I am getting this error in the console.

Uncaught TypeError: Object [object Object] has no method 'bxSlider'

I have no idea why this is happening though. I had all of this working perfectly but then when i put it into a NetSuite store it stops working.

This is running jQuery in NoConflict i don't need to change all of the "$" to jQuery in the plugin do I?

This is where i am calling jQuery, the Plugin and the script for it.

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">jQuery.noConflict();</script>
<script type="text/javascript" src="/site/js/modernizr.custom.93936.js"></script>
<script src="/site/js/jquery.bxslider.js"></script>
<script>
jQuery(document).ready(function(){
  jQuery('.bxslider').bxSlider({
  auto: true,
  controls: false   
});

});
</script>

And this is the entire console error.

Uncaught TypeError: Object [object Object] has no method 'bxSlider' dtv:57 (anonymous function) dtv:57 n jquery.min.js:2 o.fireWith jquery.min.js:2 e.extend.ready jquery.min.js:2 c.addEventListener.B

What could be the cause here i am so lost have been trying every little thing that i know and nothing is making it work.

Upvotes: 1

Views: 13999

Answers (5)

Amanda
Amanda

Reputation: 159

I got this when omitting the braces () when declaring the function.

Incorrect code:

var calcResults = (function () {
.....
});

Correct code:

var calcResults = (function () {
.....
})();   //<<--  these () were missing

Upvotes: 0

Mark
Mark

Reputation: 11

I found that putting

jQuery(document).ready(function(){
  jQuery('.bxslider').bxSlider({
  auto: true,
  controls: false   
});

})

in a file (settings.js, was also more efficient in detecting where the error was and apparently more likeable by WordPress.

Upvotes: 0

DDDD
DDDD

Reputation: 3940

This is also a problem if you have not raked assets.

rake assets:clean && rake assets:precompile

Upvotes: 0

Marty
Marty

Reputation: 621

It may be because of a jquery conflict and it is good advice to check your code (for instace using the console or developer tools of your favorite browser) for jquery being loaded twice.

You should also check to see if the js file for bxSlider is being loaded in the console as there may be a typo in the path to it.

One other reason that could cause this is the order in which scripts are loaded. If bxSlider is loaded before jquery it will give this error. You can check this by looking at the source code for the page or by looking at Network tab in developer tools.

Upvotes: 0

Sumit Raghav
Sumit Raghav

Reputation: 630

May be it because of jquery conflict. Please recheck your code, may be you added jquery twice. Or change the latest jquery.

Upvotes: 1

Related Questions