How to Select a jQuery UI tab with Javascript

How to Select a jQuery UI tab with JavascriptThe documentation for jQueryUI tabs is a bit cryptic. It was not immediately clear how to Select a jQuery UI tab with Javascript, but I got it working with this little bit of code:

$( “#tabs” ).tabs( ‘select’, “#profile” );

`#profile` is the `id` of the tab you would like to select, and `#tabs` is the element you set up the tabs on by calling `$( “#tabs” )`

You may also have to use `jQuery` instead of `$` if you have `noConflict` mode enabled, the tabs need to be initialized first (as previously mentioned), and it is possible you will need to put all this info inside the ‘jQuery document ready’ wrapper:

jQuery(function($){
$( “#tabs” ).tabs( ‘select’, “#profile” );
});

Related Posts:

  • No Related Posts
This entry was posted in Tech Tips, Web Development and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *