超简洁的jquery操作页面中iframe内的dom元素

$("#iframe1").contents().find("#news_text").html("");

iframe1:页面中的iframe的ID;

news_text:iframe内需要被操作的元素的ID;

JS代码如下:

document.getElementById('iframe1').contentWindow.document.getElementById('news_text').style.color='red' 

原文地址:https://www.cnblogs.com/ahjesus/p/1998643.html