el.classList is undefined

document.getElementsByClassName returns an "array-like" collection of elements, even if there is only one element with that class name. To access elements with document.getElementsByClassName, you can use array syntax.

for exampe logIn = document.getElementsByClassName('log_in')[0]

want to add a class to that element?

document.getElementsByClassName('log_in')[0].className += " foo";


signIn is the result of document.getElementsByClassName('sign_in modal') - getElementsByClassName returns a collection - so you have to reference the index you want:

console.log(signIn[0].classList);

Demo: https://jsfiddle.net/swf5zc74/1/