views:

24

answers:

1

I want to launch an ajax call whenever an accordion tab is opened to get the content of that tab. For that I need to know what tab was left and what tab is opened. From the jquery documentation:

$('.ui-accordion').bind('accordionchange', function(event, ui) {
  ui.newHeader // jQuery object, activated header
  ui.oldHeader // jQuery object, previous header
  ui.newContent // jQuery object, activated content
  ui.oldContent // jQuery object, previous content
});

In firebug I can see that what I need is the ui.newContent or ui.oldContent.
These appear to be the actually divs, so I somehow need to get at their id's.

function OnAccordionChanged(event, ui) {
    //get the id of the old tab
    var oldId = ui.oldContent.id;

    //apply (business) filters 
    //get the id of the new tab
    //fetch the content 
    //append to new tab
    //party
}

It's basically the verry first step where I fail :S

A: 

You get the ID of a (jQuery) DOM object via

my_object.attr("id")
balpha