Create, and activate a tab.

Create, and activate a tab.


Beginners question, so bear with me.

According to  the documentation, I can create a new tab with the following snippet:

  1.             var tabId = "tab-" + data.id;  // Data is an item, which has been clicked.
  2.             $("<li><a href='" + tabId + "'>Some text</a></li>").appendTo("#tabs .ui-tabs-nav");
  3.             $("#tabs").tabs("refresh");

Works fine. However, there's one detail missing: How could I activate the created tab?

Thanks,

Jochen