0

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!

Furly
  • 1
  • Check this https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/contentWindow . You can access content of iframe using this and do whatever you want. – Harinder Singh Dec 13 '20 at 08:30

1 Answers1

0

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

JustRaman
  • 1,101
  • 9
  • 11
Rajen Trivedi
  • 1,225
  • 2
  • 5
  • 10