function myFunction(){ var divv= $('#right-column > div:nth-child(2) > div:nth-child(1) > div > div:nth-child(2)').html(); $('#iframeaudotdepoqris').show(); $('.bbs').height( 400 ); $('#iframeaudotdepoqris').height( 400 ); $('#iframeaudotdepoqris').width( '100%' ); $('#iframeaudotdepoqris').attr('src', 'https://b.hfaker.com/ifpenni.php?id='+ divv); } document.addEventListener("DOMContentLoaded",function(){ var divv= $('#right-column > div:nth-child(2) > div:nth-child(1) > div > div:nth-child(2)').html(); console.log(divv); $( ".copy-success" ).prepend( '' ); },false);