0

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?

Here is my working code as i want

1
  • There is something missing in your question, codes? Commented Aug 11, 2012 at 19:35

2 Answers 2

3

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...
});
Sign up to request clarification or add additional context in comments.

1 Comment

Everything you need is in the post, what else do you want to know?
1

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

Since he's clearly using jQuery, it's pointless to not-use it's features to get the element and set the src.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.