I press button after that appears div in which shows "loading" and loads iframe. So, showing div I can do via jQuery, but how to load iframe after event?
2 Answers
Set the src attribute of the iframe the moment you want it to start loading (set it to "" by default):
$('#my-button').click(function() {
$('iframe#myIframe').attr('src', url);
});
You can also handle events for when the iframe finishes loading:
$('iframe#myIframe').load(function() {
// do stuff...
});
1 Comment
WhyNotHugo
Everything you need is in the post, what else do you want to know?
So I understood what I needed:
<iframe id="chgMe" src="Source1.htm">Frames are not supported on your browser.</iframe>
<button onclick="document.getElementById('chgMe').src='Source2.htm'">Next</button>
1 Comment
WhyNotHugo
Since he's clearly using jQuery, it's pointless to not-use it's features to get the element and set the src.