Skip to content

Instantly share code, notes, and snippets.

@aarondufall
Created November 11, 2014 01:52
Show Gist options
  • Save aarondufall/87eff0f7b1861264d706 to your computer and use it in GitHub Desktop.
Save aarondufall/87eff0f7b1861264d706 to your computer and use it in GitHub Desktop.
function setupTabsFor(tableName, initialTabLocation) {
$('#' + tableName + '-tabs a').click(function (e) {
e.preventDefault()
window.location.hash = this.href.split('#', 2)[1];
$(this).tab('show')
})
var location = window.location.hash;
if(!location) location = '#' + initialTabLocation
$('#' + tableName + '-tabs a[href="' + location + '"]').tab('show')
$('[data-toggle=tooltip]').tooltip()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment