I have the below code that is in my DOM and I want to get height of the #iframe2
Basically, I have to change the height of #iframe1 whenever the height of #iframe2 changes. I have added a link to screenshot below for what I am exactly trying to achieve.
https://i.sstatic.net/UCXvC.png
<div id="gpt-leaderboard">
<iframe id="iframe1">
<iframe id="iframe2" >
<!-- Banner with dynamic height loads here-->
</iframe>
</iframe>
</div>
I am using the below code to get the height but it is not working
document.getElementById("gpt-leaderboard").getElementsByTagName('iframe')[0].getElementsByTagName('iframe')[0].style.height;
Any ideas why?
style="height: 90px;"getElementsByTagName()method in there.