-2

I successfully changed the source of an iframe by writing a jQuery script on $(document.ready()) to change the src attribute from "http://tobechangedurl.com" to "http://newurl.com"

Below is the iframe element:

<p><iframe width="748" height="475" frameborder="0" src="http://tobechangedurl.com" style="margin-left: 50px;"></iframe></p>

and it works fine. But, I would like to know when exactly a document.ready function gets triggered, there was a time when I was doubting the change will not work as I was thinking the iframe will load the tobechangedurl and then the script will change the src to newurl.

Paul Roub
  • 36,322
  • 27
  • 84
  • 93

1 Answers1

0

$(document.ready()) is jQuery detecting the state of readiness.

This only occurs once the entire page is ready for JavaScript.

I recommend reading about the jQuery library here: https://learn.jquery.com/about-jquery/ this could also help you discover more about it.

I hope this helps!