I am using this little script to toggle classes of an element on click of another element. Here is the stripped down code:
//Toggle comments
function togglecomments() {
function shiftcomments() {
var comments = document.getElementsByTagName('aside')[0];
if(comments.className = "hide"){comments.className = "show";}
else{comments.className = "hide";};
}
var commenttoggle = document.getElementById('toggle-comments');
bindEvt(commenttoggle, "click", shiftcomments);
}
bindEvt(window, "load", togglecomments);
The thing is it works once, but after that on click the class does not toggle anymore. For those interested here is the event handler I use: http://pastebin.com/md3dPvMJ (It worked fine before so it shouldn't be the problem.)
Any ideas what I did wrong?
Thanks for your feedback guys!