Search code examples
jquerysyntax-errorbxslider

jQuery bxSlider "unexpected token" error


Hello everyone,

I am using jQuery bxSlider. My code is as follows:

jQuery(document).ready(function() 
    {
        jQuery('.abc').bxSlider(function()
            {
                mode: 'fade',
                captions: true;
            });         
    });

But it throws following error:
Uncaught SyntaxError: Unexpected token :

Can anyone help me? Your help will be highly appreciated.


Solution

  • That's an object. And they don't have ;s.

    captions: true;
    //------------^
    

    Remove the ; and the way you are initializing is also wrong. Make it look like:

    jQuery(document).ready(function() {
      jQuery('.abc').bxSlider({
        mode: 'fade',
          captions: true
      });         
    });