JQuery UI tabs notgetting selected
Hi,
I'm trying to add a new tab dynamically to the JQuery-UI tab. The problem is that the newly created tab is not getting selected automatically.
I want the newly added tab to be selected automatically. How to fix the problem?
This is my code:
- $(document).ready(function(){
-
- var tabs = $("#container-1").tabs();
- $('#add_tab').click( function(){
- var ul = tabs.find( "ul" );
- $( "<li><a href='#newtab'>New Tab</a></li>" ).appendTo( ul );
- $( "<div id='newtab'>Name :<input type='text'></input></div>" ).appendTo( tabs );
- tabs.tabs( "refresh" );
- tabs.tabs("select", 1);
- });
- });