Steve
Steve

Reputation: 3080

jQuery Add Tab Creates Extra Span

I have a simple Tab setup using jquery.

I use the following function to create a extra jQuery tab and insert it where I please

$('#tabs').tabs('add', "ElementId", "Tab Text", intPosition);

The buy can be seen here.

http://jsfiddle.net/qKBUu/88/

The theme helps to clearly show that the latest tab that is inserted as a extra span around the text of the tab

<li class="ui-state-default ui-corner-top">
    <a href="#ui-tabs-2">
        <span>Delivery 66</span>
    </a>
</li>

Can any one explain why it adds the span when adding tabs but not when creating the initally?

I believe this may be a bug of jQuery?

Upvotes: 2

Views: 285

Answers (1)

sbeliv01
sbeliv01

Reputation: 11820

That span is part of the default when adding a new tab. Check out "tabTemplate" option - http://jqueryui.com/demos/tabs/#option-tabTemplate.

If you want to change the tabTemplate, just add in your own:

$('.selector').tabs({ tabTemplate: '<li><a href="#{href}">#{label}</a></li>' });

Updated fiddle: http://jsfiddle.net/qKBUu/89/

Upvotes: 2

Related Questions