Hallo,
I would like to find an element (by id) in my page, to verify if a child exist, and in this case, to set an attribute to it.
The code I came out with is this:
But I get an error when I try to set the attribute. Does someone see a mistake? Thanks
I would like to find an element (by id) in my page, to verify if a child exist, and in this case, to set an attribute to it.
The code I came out with is this:
Code:
window.onload = function()
{
var hmnode = document.getElementById('HouseMenuNavCurrentItem');
if (hmnode.childNodes[1])
{
var element = hmnode.childNodes[1];
element.setAttribute('style', 'display:show');
}
};
But I get an error when I try to set the attribute. Does someone see a mistake? Thanks