jquery accordion: activate option using Struts <sj:accordion>

I have a Struts 2 application that is utilizing the accordion feature of the Struts2 jQuery plugin (http://code.google.com/p/struts2-jquery/wiki/AccordionTag) and I'm trying to programmatically traverse through the accordion items. What I mean is that I basically want to have a button in each accordion content area that opens up the next accordion item below it. Using plain jQuery outside of my Struts application, I seem to be able to do this: $("#accordion").accordion('activate', x);, as described here: Jquery accordion activate

When i try to do this with my struts jquery implementation, however, it screws up the rendering of my accordion altogether. Unfortunately, using plain jQuery UI doesn't seem to be an option for me. Is there any other possible way to do this with what I'm currently working with? Is it even possible to use jQuery to manipulate the accordion object that struts created?

Any help would be greatly appreciated. I really want to continue using the accordion in this fashion because it's very easy to use, but I'm not sure that it's flexible enough to suit my purposes.

Thanks in advance for any advice you can provide.

Answers


this is so awesome, i figured i would share with the world :)

All i had to do was add this code $("#accordion").accordion('activate', 0); to an area below my sj:accordion object. My problem was that i was putting this code in the head of my document, but I'm assuming there is a difference in when the elements are rendered, therefore I can only reference this object after it's actually been created. Now I can bind the click event of buttons to open different accordion items. It's working like a charm!


Need Your Help

In javascript, is accessing 'window.Math' slower or faster than accessing the 'Math' object without the 'window.'?

javascript performance window global-variables global

I'm kind of curious about what the best practice is when referencing the 'global' namespace in javascript, which is merely a shortcut to the window object (or vice versia depending on how you look at

Bitmap cache on DrawingVisual has blurry parts

c# caching bitmap geometry drawingvisual

Recently I switched to DrawingVisuals to increase the performance of our trending graphs (especially zooming and panning).

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.