Bruce MacKay schrieb:
> Hello folks,
> 
> I'm trying to retrieve the ID of the current tab (a la Klaus) to pass to 
> a function (tFocus).
> 
> My attempt thus far...
> 
> $("#editor").tabs({fxFade: true, fxSpeed: "fast", onShow: 
> tFocus($(this).attr("id"))});
> 
> but this just returns "undefined" to tFocus - which I'm sure won't 
> surprise many of you, but has stumped me.
> 
> A hand up out of this hole would be appreciated.
> 
> Cheers,
> 
> Bruce

Bruce, you have to pass in a function reference, not the function call 
itself, so unless tFocus does not return a function try this:

$("#editor").tabs({
     fxFade: true,
     fxSpeed: "fast",
     onShow: function(clicked) {
         tFocus(clicked.id);
     }
});

This will pass the id of the last clicked anchor (tab) to tFocus after 
the tab content got shown.

Does that work or do you need the id the div that holds the content for 
a tab?

The callbacks onClick, onHide, onShow get passed three parameters:

onShow: function(clickedTabLink, contentDivOfClickedTab, 
contentDivOfHiddenTab) {
     // alert id of div that holds
     // content for current tab
     alert(contentDivOfClickedTab.id);
}


-- Klaus


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to