我想要 .html()
iFrame 的。但我只想要特定元素的代码<img id="picture">
。我如何获取 HTML,但只有 <img id="picture">
具有所有参数。
类似于:
$('#mydiv').find("iframe").contents().find("body").html(/*only get html of image here*/);
谢谢!
最佳答案
我建议:
var imgEl = $('#mydiv iframe #picture'),
imgHTML = imgEl.prop('outerHTML');
关于javascript - 使用 .html() 仅从内容中取出特定元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22949827/