On 6 Apr., 18:16, expresso <[email protected]> wrote:
> trying to check the selected tab index here.  Not sure why my way is not
> working but also wondering if I could use the "this" object?  I know the
> line to change the image works, because I've seen it change but can't get
> the check for selected to work when I click on a tab so that only the right
> image changes.
>
>           var selected = $('#tabs').tabs('option', 'selected');
>
>           $('#tabs').tabs().click(function() {
>               if (selected == 0) {
>                   $('img#FormContenTab').attr({ src:
> "/Content/Images/Product/tabset1_per_on.gif" });
>               }
>               else if (selected == 1) {
>                   $('img#imgOtherTab').attr({ src:
> "/Content/Images/Product/tabset3_other_on.gif" });
>               }
>               else if (selected == 2) {
>                   $('img#imgRaTab').attr({ src:
> "/Content/Images/Product/tabset4_re_on.gif" });
>
>               }
>           });


You need to retrieve the selected tab on every click:

$('#tabs').tabs().click(function() {
    var selected = $('#tabs').tabs('option', 'selected');
    ...
});

Although you could just use the selected handler:

$('#tabs').tabs({
    selected: function(event, ui) {
        var selected = ui.index;
        ...
    }
});


--Klaus

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to