I have a website with many DIV elements without ID. The code of this website is created automatically with JavaScript, I can't change it. To change the z-index of selected elements without ID, I have to address them with JavaScript, with CSS it doesn't work.
How can I address children and grandchildren without ID using JavaScript?
I tried different functions but they do not work yet:
function huhu() {
var x = document.getElementById("parent-element-with-id");
x.querySelectorAll("*").style.zIndex = "9999";
}
function huhu() {
document.querySelectorAll("#39 *").style.zIndex = "9999";
}
function huhu() {
document.querySelectorAll("#39 > div > div).style.zIndex = "9999";
}
The JavaScript event:
<div onmouseover="huhu()"></div>
The working function:
function huhu() {
document.getElementById("parent-element-with-id").style.zIndex = "9999";
}
The grandchild DIV without ID I want to address:
<div id="parent-element-with-id">
<div>
<div>
</div>
</div>
</div>
Besides, I also intend to address all *
children and grandchildren. How can I achieve this?