var cen = document.getElementsByClassName('')[0] code example Example: getelementbyclass var selector = document.getElementsByClassName('class-name');