I have an accordion that...
- When clicked i want the next
ddsection to expand. - If another is clicked i want all the other open sections to close first
- If an open title is clicked Id like to close...
I have the following example that I cant get working...
jQuery
$(".accordion > dt > a").click(function () {
$(".accordion a").removeClass('active');
if ($('.accordion > dd').next().is(':visible')) {
$(this).removeClass('active');
$('.accordion > dd').slideUp(200);
} else {
$(this).addClass('active');
$(this).parent().next().slideDown();
}
});
HTMLcodeelsecondition to work. And also the last rule is your CSS looks faulty.