Created
June 19, 2012 13:55
-
-
Save pinglamb/2954365 to your computer and use it in GitHub Desktop.
Select Active Item JS
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
var links = document.getElementsByClassName('link'); | |
var choose = function() { | |
for(var j=0; j < links.length; j++) { | |
links[j].className = ''; | |
} | |
this.className = 'active'; | |
}; | |
for(var i=0; i < links.length; i++) { | |
links[i].addEventListener('click', choose, false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment