0

I want to perform some functions on iframe. However, the functions does not work when the page is loaded.

I suppose that the functions are triggered before iframe elements are rendered. Either $(window).load or $(document).ready perform before iframe are set up.

So, I would like to ask how to perform jQuery functions after iframe elements are rendered.

My source code is like this;

$(document).ready(function() {
    doSomething($("ID of iframe"));
});

$("iframe").ready() does not work either. In addition, I would like to apply this function for not all iframe fields, so $("iframe").each() is not appropriate.

I already read and tried these questions, but any of them did not work.

Wait for iframe to load in JavaScript

Making script wait until iframe has loaded before running

Wait for iframe to load before next function is triggered?

Kota.M
  • 117
  • 7
  • `$('#id-of-iframe').load()` definitely works... – BenM Aug 31 '21 at 21:58
  • `$("iframe").load` does not work, unfortunately. I inserted `console.log` inside the `$("iframe").load`, but it is not performed either. – Kota.M Aug 31 '21 at 23:19
  • You can use the on function: https://stackoverflow.com/questions/10920355/attaching-click-event-to-a-jquery-object-not-yet-added-to-the-dom – Nathaniel Flick Sep 01 '21 at 03:59

0 Answers0