I am trying to create a basic a accordian style menu. Im guessing i have done 90% of the code, but a little stuck now.

I have three widget and what I am attempting to do is hide all the widgets apart from the one actually clicked. My code so far is as follows.

$(".widget-title").click(
		function () {
		  $("#widget1_content").hide(); //My Widgets
		  $("#widget2_content").hide();
		  $("#widget3_content").hide();
		  $(this).parent().next().toggle(); // Toggle the Content Box
		  $(this).parent().parent().toggleClass("closed-widget"); // Toggle the class "closed-widget"
		  $(this).parent().find(".content-box-tabs").toggle(); // Toggle the tabs
		}
	);

Any help would be appriciated.

Can you upload your code to the server and send us the URL of the page so that we can see the real scenario?

Hi if you check jquery UI demo here.
Once you click on another widget rest will automatically closed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.