Thanks Mauro for your code,
it works with standart tabs but when i add ajax tabs id is generated
randomly,
and i need to check if same titled tab is exists.
so i changed your code to look at tab text.
function getIndexForId( tabsDivId, searchedId )
{
var index = -1;
var i = 0, els = $("#" + tabsDivId).find("a");
var l = els.length, e;
while ( i < l && index == -1 ) {
e = els[i];
var tabName=$(e).find("span").html();
if (searchedId == tabName) {//$(e).attr('href'))
index = i;
}
i++;
};
return index;
}
On Dec 4, 5:30 pm, Mauro Chojrin <[email protected]> wrote:
> Hi:
>
> I found a solution. It could be improved, but so far it's working,
> maybe someone can find it useful:
>
> function getIndexForId( tabsDivId, searchedId )
> {
> var index = -1;
> var i = 0, els = $("#" + tabsDivId).find("a");
> var l = els.length, e;
>
> while ( i < l && index == -1 )
> {
> e = els[i];
>
> if ( "#" + searchedId == $(e).attr('href') )
> {
> index = i;
> }
> i++;
> };
>
> return index;
>
> }
>
> Bye.
>
> On 3 dic, 14:02, Mauro Chojrin <[email protected]> wrote:
>
> > Hi:
>
> > I have a problem using the jquery tabs. I think it should be rather
> > easy to resolve, but I just can't figure it out and couldn't find the
> > answer anywhere. Here is the thing:
>
> > I have a tab display, which is loaded dinamically, this means, each
> > time i press a certain button, a new tab is added to the tab
> > collection, now, what I need to do is see whether the tab id to be
> > added is already there.
>
> > I tried to iterate over the tabs collection, but couldn't figure how
> > to do this.
>
> > Thanks!
--
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.