jquery - javascript populate iframe, modify source in one -
Contain content of 2 iframes with the same HTML preview. However for one of the iframes, I need to modify the data / html by removing images. It gives me: What is the correct way to modify the source? I did not read through jquery docs Preview: Keep in mind that I think you should try it instead: By adding a div wrapper, you can ensure that If you are adding a full HTML page to the Iframe, then you can try it: $ Ajax ({url: '', datatype: 'text', success: function (data) {if (data) {var iframe = document.getElementById ('preview'); Iframe.parentNode.style.display = "block"; Iframe = (iframe.contentWindow)? Iframe.contentWindow: (iframe.contentDocument.document)? Iframe.contentDocument.document: iframe.contentDocument; iframe.document.open (); Iframe.document.write (data); iframe.document .close (); var iframe = document.getElementById ('preview-noimgs'); iframe.parentNode.style.display = "block"; iframe = (iframe.contentWindow)? iframe.contentWindow: (iframe.contentDocument.document) ? Iframe.contentDocument.document: iframe.contentDocument; iframe.document.open (); var $ data = $ (data); $ data.find ("img"). RemoveAttr ("src"); iframe.document.write ($ Data.html ()); iframe.document.close ();}}});
NULL or
depends on the object object if I
.html ()
parse HTML () but unfortunately it would not be able to use it because we are limited to version 1.7.1. The way?
.html () Internal HTML , not external HTML
var $ data = $ ("& Lt; div>;" + data + "");
$ data.html () returns the correct original node.
iframe = document.getElementById ('preview-noimgs'); iframe.parentNode.style.display = "block"; Var iframeWindow = (iframe.contentWindow)? Iframe.contentWindow: (iframe.contentDocument.document)? Iframe.contentDocument.document: iframe.contentDocument; iframeWindow.document.open (); iframeWindow.document.write (data); IframeWindow.document.close (); .. $ (Iframe) .contents () looks ("html") sounds ("img") removeAttr ("src"). Remove // `src`
Comments
Post a Comment