I am attempting to use ClassName in order to obtain elementID across multiple layouts for a specific button. By having the following code, how can I obtain the element ID?
var fwdButton = document.getElementsByClassName("fwdButton");
I’ve been trying:
var fwdButton = document.getElementsByClassName("fwdButton").id; //incorrect
or directly attempted to modify its text by using:
var fwdButton = document.getElementsByClassName("fwdButton");
fwdButton.innerHTML='myText';
But none of them worked for me.
So question is: How can I update fwdButton text or any of its property? as well as how can I obtain the ElementID to access to its innerHTML in case of no way with first attempt?
var a = document.getElementsByClassName("fwdButton")[0].id;
var b = hypeDocument.getElementById(a);
b.innerHTML='Skip';
In addition, I guess that by using className and having a couple of objects associated to same class, at the end I should use the following code to update all of them across different layouts, right?
var classElements = document.getElementByClassName("fwdButton");
for (i==0, classElements.lenght; i++) {
a = document.getElementByClassName("fwdButton")[i].id;
b = hypeDocument.getElementById(a);
b.innerHTML='Skip';
}