日期:2014-05-16  浏览次数:20343 次

求教怎么用jquery操作从iframe中获得的dom
var doc;
doc = document.getElementById("iframeautoheight").contentDocument; 

doc就是已经得到的dom
我想用jquery操作doc里面的dom  比如有个id为data的元素

alert(doc.getElementById("data").innerHTML);//用原生js可以这样得到
alert($("data").html());//但是后面的操作用到了很多jquey,所以想用这种方式

------解决方案--------------------
$('#iframeautoheight').contents().find('#data').html()
------解决方案--------------------
引用:
$('#iframeautoheight').contents().find('#data').html()

正解