[].forEach.call(document.querySelectorAll(".tab-links a"), function(x) {
x.addEventListener("click", function() {
[].forEach.call(document.querySelectorAll(".tab-links a"), function(y) {
x.classList.remove("selected");
});
this.classList.add("selected");
}, false);
});
Using the classList object, you need to iterate, attach the event, and re-iterate to remove instances of the class selected