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?
Asked
Active
Viewed 200 times
0
-
What kind of tabs? Are you using a tabs plugin? What have you tried? Please be more specific and show some effort. – Ry- Apr 11 '12 at 02:08
-
it is specified by the tag, and in the content I also said which tab I use. Again FYI its jquery tab. Should I specify more Sir?:) – aintgel Apr 11 '12 at 02:24
-
Yes, you should have specified [tag:jquery-ui-tabs] as at least a tag. There are countless "jQuery tab" plugins out there. – Ry- Apr 11 '12 at 03:02
2 Answers
1
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

neoascetic
- 2,476
- 25
- 34
0
if it is just for UI display, just simply trigger the tab click action programmatically like this $("tab2Selector").click();

S.831
- 113
- 1
- 10