I am applying style values on div array and it is working fine. I am able to find the div with class in the code below but i have to select section and articles with class as well.
var selectors = ["header-wrap", "top-page", "footer","sidepanels"];
var arrayLength = selectors.length;
for (var i = 0; i < arrayLength; i++) {
var parentDoc = window;
while (parentDoc !== parentDoc.parent) {
parentDoc = parentDoc.parent;
}
parentDoc = parentDoc.document;
//getting div content
var divContent = parentDoc.getElementsByClassName(selectors[i])[0];
if (divContent) {
divContent.style.position = 'relative';
divContent.style.zIndex = '1';
}
The above code is working fine. Is there any better approach in jquery of doing the same thing ?