简体   繁体   中英

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"?

I have tried using this other suggestion here without any results.

Many thanks in advance!

Use jQuery & code should be as below:

$(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();
    }
});

Working Fiddle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM