December 2013
Intermediate to advanced
384 pages
9h 54m
English
var objs = document.getElementsByTagName("div"); for (var i=0; i<objs.length; i++){ var htmlElement = objs[i]; ... }
Another way search for HTML elements is by their HTML tag using the document.getElementsByTagName(tag). This function searches the document for all DOM objects that have the specified tag name and returns them in an array. You can then iterate over that array using a JavaScript loop and access or apply changes to each DOM element.
Read now
Unlock full access