最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Uncaught TypeError: Object [object Object] has no method 'bxSlider' - Stack Overflow

programmeradmin2浏览0评论

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=".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.

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./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.

Share Improve this question asked Oct 7, 2013 at 18:13 TravisTravis 2,2457 gold badges29 silver badges44 bronze badges 4
  • 1 make sure your path to the bxslider js file is correct and is loaded .. – bipen Commented Oct 7, 2013 at 18:14
  • I know the path is correct because i can open it from viewing the source. How can i make sure that it is loaded? I would assume that is the issue is it isn't loading the bxslider.js – Travis Commented Oct 7, 2013 at 18:16
  • 1 There are three possible ways to get this error given the code you're using: The first, something is overriding jQuery (which isn't happening in the code you provided), the second is the file path is wrong, and the third is an error is occurring within the plugin(which you would be able to see in the console) – Kevin B Commented Oct 7, 2013 at 18:17
  • Thanks @KevinB i found jQuery being called in the footer. I guess that is what i get for working on this with a team. Someone must have added it at the bottom. Ugggh thanks for making me looking for it. – Travis Commented Oct 7, 2013 at 18:26
Add a ment  | 

5 Answers 5

Reset to default 1

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

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.

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

rake assets:clean && rake assets:prepile

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.

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

Incorrect code:

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

Correct code:

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

评论列表(0)

  1. 暂无评论