Created
February 28, 2017 15:01
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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