简体   繁体   中英

jQuery UI Tabs - calling function within tab resets to the first tav

I'm using jQuery UI tabs for simple tab navigation on a page, and this works great; however, I want to call a function like

function DoStuff(){  
   $("#divID").hide();
}

from within a tab. When I click on the <a href...> which calls the DoStuff() function, I see the div being hidden, but then the current tab which I am in is closed and the first tab is opened. Why is this happening and how would I fix this? Do I need to figure out which tab I am in and then select that tab after I hide the <div> ?

are you remembering to return false in your DoStuff() callback for the tag click? You might be reloading the page, or at least changing the hash in the url, which can have an effect on which tab you have open.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM