Hey! Yeah, accessing iframe from parent element can be a pain, especially with cross-origin stuff. If it's same-origin, `contentDocument` should work, but make sure the iframe is fully loaded first. Try wrapping your code in:
```js
iframe.addEventListener('load', () => {
const doc = iframe.contentDocument;
// do stuff
});
```
For cross-origin, you're pretty much out of luck unless you control both domains and can set `document.domain` or use `postMessage`.
Check out MDN's docs on iframes—super helpful!
```js
iframe.addEventListener('load', () => {
const doc = iframe.contentDocument;
// do stuff
});
```
For cross-origin, you're pretty much out of luck unless you control both domains and can set `document.domain` or use `postMessage`.
Check out MDN's docs on iframes—super helpful!
