Skip to content

Instantly share code, notes, and snippets.

@davidtrushkov
Created February 28, 2017 15:01
Show Gist options
  • Save davidtrushkov/eafe0316f6b5096fd921345234fcb31b to your computer and use it in GitHub Desktop.
Save davidtrushkov/eafe0316f6b5096fd921345234fcb31b to your computer and use it in GitHub Desktop.
Dynamically add a active class to tabs with Javascript. I used this in WordPress.
<script>
$(".nav-link").on("click", function(){
$(".nav").find(".active").removeClass("active");
$(this).parent().addClass("active");
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment