[英]Display a div only if an iframe contains a specific text
On this example how can I display the div with class is-dynamic
only if the div in the iframe contains this text "Keine Angebote zu «kaufen» gefunden"?在此示例中,仅当 iframe 中的 div 包含此文本“Keine Angebote zu «kaufen» gefunden”时,如何显示带有 class 的 div
is-dynamic
的?
I have tried using this other suggestion here without any results.我在这里尝试使用这个其他建议,但没有任何结果。
Many thanks in advance!提前谢谢了!
Use jQuery & code should be as below:使用 jQuery & 代码如下:
$(document).ready(function(){
var iframe = $('#frame-8be8f6c4-b1a0-8aaa-7011-ccfe2f33bf4b').text();
console.log(iframe);
if(iframe.includes('Keine Angebote zu «kaufen» gefunden')){
$('.is-dynamic').show();
} else {
$('.is-dynamic').hide();
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.