Skip to content Skip to sidebar Skip to footer

Jquery Accordion Its Not Working

I'm trying to use the jquery ui accordion plugin and I don't know why its not working. I came to http://jqueryui.com/ and read the documentation, I choose a theme and then I select

Solution 1:

Im not entirely familiar with jQuery UI accordions, but have you tried placing your $('.accordion').accordion(); inside jQuery document.ready ?

See the code below, most likely your accordion is being initialized before the actual html on the page exists. That's assuming you setup your html correctly,and you are including the proper jQuery JavaScript files etc.

$(document).ready(function() { 
 $('.accordion').accordion();
});

Hopefully that helps.

Solution 2:

From the code you have posted it should work so I can only assume it isn't including your scripts properly

If the acc folder is in the root folder of your website you should consider changing your scripts and css to:

<linkrel="stylesheet"type="text/css"href="/acc/css/jquery-ui-style.css" /><scripttype="text/javascript"src="/acc/js/jquery.js"></script><scripttype="text/javascript"src="/acc/js/jquery-ui.js"></script><scripttype="text/javascript"src="/acc/js/acc.js"></script>

Remove the dots - as that means you are trying to get to a folder one up from where you are (in the url, not the file with the html).

If this doesn't work then press f12 and check your console, you may have other js errors stopping the the accordion working

Solution 3:

Sounds like you unchecked the JqueryUI Core, download the standard version of JqueryUI and overwrite the version created.

A fiddle shows that the code is correct. If you are missing the core then no widgets will work

$(function (){
    $('.accordion').accordion();
});

Post a Comment for "Jquery Accordion Its Not Working"