I am writing a GreaseMonkey script that changes the attribute of an element with a specific identifier, but I am having some problems with its access due to the unconventional HTML hierarchy. Here is the relevant HTML:
<body> ... <iframe id="iframeID"> <html> ... <body id="bodyID" attribute="value"> ... </body> ... </html> </iframe> ... </body>
Where attribute is the attribute I'm trying to change.
At first, not realizing that I was working with an iframe tag and a nested body tag, I tried this:
document.getElementById('bodyID').setAttribute("attribute","value")
While this worked fine in Firefox, Chrome tells me that I cannot set the null attribute, assuming it cannot find any elements with id bodyID . How to change this attribute in a friendly browser?
source share