Q:

JQuery - How can I manipulate tabs

How can I manipulate the jquery tab, for example when a submit form is triggered in tab2 then the page selected tab should be the tab2 not the tab1?

A:

If you use jQuery UI tabs, check their selected option. Docs.
So, in your php code you must set this option on your tabs, like so:
$('#tabs').tabs({ selected: 2}); // 2nd tab will be default selected

or so, after tabs creating (if creation code in separate file, for example):
$('#tabs').tabs('option', 'selected', 2);

Also, you can emulate clicking by tab using:
$('#tabs a[href=#tab_id]').click(); // where `tab_id` is tab content identifier

