I am trying to figure out how to select and then change the HTML in the iframe
that I am generating. IFrame displays various media (images, PDF files, etc.). To show the different elements, I first create them using something like this:
$('#mydiv').html("<iframe id='myiframe' src='path/file.jpg'></iframe>");
and then, if necessary, update its contents using something like this:
$('#myiframe').attr("src","path/newfile.jpg");
this creates HTML like this (as seen through viewing the elements of Chrome):
<div id='mydiv'> <iframe id='myiframe' src='path/file.jpg'> #document <html> <body style="margin:0"> <img style="-webkit-user-select:none" src="path/file.jpg"> </body> </html> </iframe> </div>
I want to select a dynamically generated <img>
tag so that I can adjust its width. But I cannot define a jquery selector to do this. Ideas?
source share