Reputation: 14773
I would like to get the .html()
of an iFrame. But I only want the code of an specific element <img id="picture">
. How can I get the HTML but have only the <img id="picture">
with all parameters.
Something like:
$('#mydiv').find("iframe").contents().find("body").html(/*only get html of image here*/);
Thank you!
Upvotes: 0
Views: 59
Reputation: 253318
I'd suggest:
var imgEl = $('#mydiv iframe #picture'),
imgHTML = imgEl.prop('outerHTML');
Upvotes: 2