下面是一個例子,我試圖運行刪除iframe中的類「location_description」的div元素,但它不起作用。任何解決方案
HTML
<div id="kk">
<iframe id = "weatherFrame" src="https://www.meteoblue.com/el/%CE%BA%CE%B1%CE%B9%CF%81%CF%8C%CF%82/widget/daily?geoloc=detect&days=4&tempunit=CELSIUS&windunit=KILOMETER_PER_HOUR&coloured=coloured&pictoicon=1&maxtemperature=1&mintemperature=1&layout=light" frameborder="0" scrolling="NO" allowtransparency="true" sandbox="allow-same-origin allow-scripts allow-popups" class = "weatherFrame" style = "width: 60%;height: 100%;"></iframe>
<div>
<a href="https://www.meteoblue.com/el/%CE%BA%CE%B1%CE%B9%CF%81%CF%8C%CF%82/%CF%80%CF%81%CF%8C%CE%B3%CE%BD%CF%89%CF%83%CE%B7/%CE%B5%CE%B2%CE%B4%CE%BF%CE%BC%CE%AC%CE%B4%CE%B1?utm_source=weather_widget&utm_medium=linkus&utm_content=daily&utm_campaign=Weather%2BWidget" target="_blank"></a>
</div>
</div>
的jQuery(的<body>
結束)
$('#weatherFrame').load(function(){
alert("in");
$("location_description").remove();
});
是iframe的內容和主要頁面上的同一個域? –
where'location_description'? – Mahi