0

have a look at this example link text It creates a dialog with a iframe init that loads an external page. The dialog is added to the DOM. Is it possible to delete it on dialog close event?

2 Answers 2

1

In the close event of the dialog you can .remove() it, for example:

$('<iframe src="' + this.href + '" />').dialog({
  //...current options...
  close: function() {
    $(this).dialog('destroy').remove();
  }
});

This removes the <iframe> and it's contents as well as destroying the actual dialog widget around it which is no longer useful.

Sign up to request clarification or add additional context in comments.

Comments

0

yes, if i understand you corectly you can remove() iframe from the DOM

put with code in the close event

$("#divContainerWithiFrame").remove("iframe");

http://api.jquery.com/remove/

2 Comments

if I remove a html element, all childs will be removed too?
@ArtWorkAD - Yes, though there's a much cheaper/cleaner way to remove the specific iframe of the dialog in question, see the close event in my answer :)

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.