gotqn
gotqn

Reputation: 43646

jQuery UI tabs - "remove" tab not working as expected

My jQuery UI version is "1.8.24" and I have issue using the remove method. I have thee tabs and as far as I know, they are 0-based indexed.

I have look thought other similar questions and I am using this code to remove the second tab:

$("#tabs").tabs('remove','1');

but the last tab is removed either. Actually, no matter what i index used:

 $("#tabs").tabs('remove','1');
 $("#tabs").tabs('remove','2');
 $("#tabs").tabs('remove','100');

always the last tab is removed.

Any ideas what is causing this? And something more interesting, I was not able to found this method described in the UI tabs documentation.

Upvotes: 0

Views: 1607

Answers (1)

EMMERICH
EMMERICH

Reputation: 3474

Shouldn't the second parameter be a number? jQuery is probably evaluating the String '1' and '2' to be the integer 0.

If you don't have control of the data source (e.g. you're getting it out of the DOM), do: $("#tabs").tabs('remove',parseInt('1'));

otherwise just use the correct data type:

$("#tabs").tabs('remove', 1);

Upvotes: 3

Related Questions