I\'m performing a small text with JavaScript with the getElementsByClassName() and I am getting some unwanted results. I would like the script to change each CS
By assigning a value to .className you overwrite every class on that element.
What you might want to take a look at is the .classList attribute.
Remove a class:
blockSet[0].classList.remove('block-default');
Add the new class:
blockSet[0].classList.add('block-selected');
A good point to start with, when your trying to do stuff, jQuery usually did for you, is http://youmightnotneedjquery.com/