Take an element that is inside an iframe

3

I needed to get a title that is inside an iframe, I did it with jquery but it takes a lot to fade or even disappear. I did so with jquery:

$(document).ready(function () {
    $("iframe").contents().find(".titulo").css("display","none");
});

I've tried it too, out of $ (document) .ready ():

$("iframe").contents().find(".titulo").css("display","none");

But it did not help, I think if it goes with css it disappears as soon as the page loads, how could it do with css? If not, how could I do with jquery that as soon as I entered the page that title was not visible? Home Please help me,

    
asked by anonymous 27.07.2018 / 19:45

1 answer

3

I do not know how to detect DOM loading inside an iframe, but using .on() you can fire the "load" event when the iframe has been fully loaded, and thus remove the desired element:

$('iframe').on("load", function(){
   $("iframe")
   .contents()
   .find(".titulo")
   .remove();
});
    
27.07.2018 / 20:07