getElementsByTagName() that will select all the instances of a certain HTML element on the current webpage based on its tag name, i.e. . Calling document. getElementsByTagName("div") is all you need to do to select all elements on the current page using JavaScript.