Reputation: 2344
If I create a jQuery UI tab control. I add one tab. I add a second tab. How do I switch the position of the tab?
I want to be able to create a new tab at the start of the tab buttons, so I use
$('.tabs').tabs("add","tabContent.htm","New Tab")
but this creates the tab and appends it to the end of the exisiting tab buttons, but I need it to appear at the start. How can I switch their positions using jquery?
Unsure how to remove and re-add the button before the other ones.
Upvotes: 3
Views: 545
Reputation: 4697
I believe that there is an optional 4th parameter for the .tabs method which allows for this.
.tabs( "add" , url , label , [index] );
I think this would work.
$('.tabs').tabs("add","tabContent.htm","New Tab", 0)
Upvotes: 4
Reputation: 40902
I'm not quiet sure the syntax of .tabs() but it sounds like you want .prepend(). Something like this:
//assuming .tabs is the tab container
$('.tabs').prepend( $(this).tabs("add","tabContent.htm","New Tab") );
Upvotes: 0