how to get id by document.getelementsbyclassname code example Example: getelementbyclass var selector = document.getElementsByClassName('class-name');