I have a strange behavior where I have a code rendered in the main screen based on the HTML which is stored in the DB.
If I do getElementById(‘myGivenId’) in the console of the Chrome inspector I get null. However after I click on inspect element (anywhere on the screen), and try to fetch element again, it appears.
How can I make element 'findable' by default?
Section of the code:
<div class="hidden popupbox" data-contentid="666">
<iframe width="16" height="9" src="//www.youtube.com/embed/...modestbranding=1" autohide="1"
frameborder="0" allowfullscreen="" class="video" id="myGivenId"></iframe>
</div>
Doing document.getElementById('myGivenId')