Jerome Ansia Jerome Ansia - 5 months ago 25
jQuery Question

jQuery UI tabs, update url when clicking on a different tab

I'm using the tabs of jQuery UI: http://jqueryui.com/demos/tabs/

How to update the current url of the browser when the user click on a different tab by adding the anchor link to it:
ex: url.html#tab-4 and pushing the current history of the browser at the same time.

Thank you!

DG3 DG3
Answer

This should get what you want. I used the sample html in jquery ui demos

        $( "#tabs" ).tabs({
            select: function(event, ui) {                   
                window.location.hash = ui.tab.hash;
            }
        });