select all elements of class X javascript code example Example: select all elements javascript var elements = document.getElementsByTagName("*");