Monday, March 13, 2017

Hanging off a DOM element, classList seems to hold a string array in JavaScript of all of the classes in the inline class parameter at the HTML tag.

className in contrast, has the same stuff in one string with the elements separated by spaces. className should be identical to what's in the inline class parameter at the HTML tag. Add on classes at className and not classList.

this.whatever.parentElement.className =
      this.whatever.parentElement.className + ' foo';

No comments:

Post a Comment