How to Set Active Tab in jQuery Ui -


Can you please tell me how can I set an active tab in jquery ui with a button outside of the tab ?

I have a button:

  & lt; Input id = "action" type = "submit" value = "go to action" & gt;  

And here's the code,

   

& lt; Div id = "tabs" & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "# tab-1" & gt; Details & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "# Tab2" & gt; Action & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "# Tabs-3" & gt; Resources & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "# Tab-4" & gt; Settings & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; Div id = "tabs-1" & gt; & Lt; P & gt; Description Content & lt; / P & gt; & Lt; / Div & gt; & Lt; Div id = "tabs-2" & gt; & Lt; P & gt; Action content & lt; / P & gt; & Lt; / Div & gt; & Lt; Div id = "tab-3" & gt; & Lt; P & gt; Resource content & lt; / P & gt; & Lt; / Div & gt; & Lt; Div id = "tabs-4" & gt; & Lt; P & gt; Settings & lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt;

Click action in your function for use

 < Code> $ ("# Tabs"). Tabs ({active: #});  

Where # is replaced with the tab index, which you want to select.

Edit: Switch from selected to active, selected is deprecated


Comments