For accessing iframe from parent element, timing is key. If the iframe hasn't loaded, you'll get nada.
Try this:
```js
document.querySelector('iframe').addEventListener('load', function() {
const innerDoc = this.contentDocument;
// now you can mess with it
});
```
Cross-origin? Nope. Browsers won't let you. `postMessage` or bust.
Try this:
```js
document.querySelector('iframe').addEventListener('load', function() {
const innerDoc = this.contentDocument;
// now you can mess with it
});
```
Cross-origin? Nope. Browsers won't let you. `postMessage` or bust.
