How can I get grandchildren div and iframe of a document in javascript ? I have the id of div and name of iframe
Use .querySelectorAll()
Example:
document.querySelectorAll("#iframeId .someSelector");
If you have an ID for child you can just use that:
document.getElementById("divId");
Or you could use a combination of selectors like so:
document.querySelectorAll("#iframeId > .someSelector > *");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With