am using this jquery but for some reason am getting this error
<!-- jQuery library (served from Google) -->
<script src="//ajax.googleapis/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
am using this jquery but for some reason am getting this error
<!-- jQuery library (served from Google) -->
<script src="//ajax.googleapis./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
Share Improve this question edited Aug 20, 2014 at 15:39 al123 asked Aug 20, 2014 at 15:32 al123al123 5699 silver badges25 bronze badges 6- can you show plete code? – Ehsan Sajjad Commented Aug 20, 2014 at 15:35
- the error is in that function – al123 Commented Aug 20, 2014 at 15:36
- 1 where have you included js files?? – Ehsan Sajjad Commented Aug 20, 2014 at 15:37
- top of the page with all the other scripts as seen above – al123 Commented Aug 20, 2014 at 15:39
- are you sure the url fo bxSlider file is correct? – Ehsan Sajjad Commented Aug 20, 2014 at 15:40
1 Answer
Reset to default 3$(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));