How to swap jquery ui tab position with another ui tab using jquery?

If I create a jQuery UI tab control. I add one tab. I am adding a second tab. How to change tab position?

I want to create a new tab at the beginning of the tab buttons, so I use

$('.tabs').tabs("add","tabContent.htm","New Tab")

but this creates a tab and adds it to the end of existing tab buttons, but I need it to appear at the beginning. How can I switch my positions using jquery?

Not sure how to remove and add a button again before others.

+3
source share
3 answers
$('.tabs').tabs("add","tabContent.htm","New Tab", 0)
+2
source

I believe that there is an optional 4th parameter for the .tabs method that allows this.

.tabs( "add" , url , label , [index] );

I think this will work.

$('.tabs').tabs("add","tabContent.htm","New Tab", 0)
+4
source

, .tabs(), , .prepend(). - :

//assuming .tabs is the tab container
$('.tabs').prepend( $(this).tabs("add","tabContent.htm","New Tab") );
0

All Articles