dsi
dsi

Reputation: 3359

How to achieved switch/open to div same as href="#tabs-3" in jquery?

I I have below html line.

 <a href="#tabs-3" onclick="CallFunc()">d</a>

replaced with below line:

<a href="javascript:void(0);" onclick="CallFunc()">d</a>

Inside CallFunc() , i need to write jquery which will give me same function as href="#tab-3" (so, switch to that tab)

Please share me how it is achieve in jquery ? When we click at href="#tab-3 then it page just switch to that particular DIV, due to some UI design, i needed to remove this line from UI though need to maintain that feature using JQUERY, so, what is equivalent jquery ?

Upvotes: 0

Views: 83

Answers (1)

Ivanka Todorova
Ivanka Todorova

Reputation: 10219

You can use in your CallFunc() this:

$("#tabs").tabs({active: 2}); //it will make your 3rd tab active

And if you want to set it after the plugin's initialization do this:

$( "#tabs" ).tabs( "option", "active", 2 ); //just select the right tab as the third parameter

More Info: Tabs Widget Doc options:active

Also you can leave the tabs, and fire CallFunc() in the activate event.

activate( event, ui )Type: tabsactivate

Triggered after a tab has been activated (after animation completes). If the tabs were previously collapsed, ui.oldTab and ui.oldPanel will be empty jQuery objects. If the tabs are collapsing, ui.newTab and ui.newPanel will be empty jQuery objects.

Tabs Widget Docs

Upvotes: 1

Related Questions