Salut mon code retourne tout le html de l'iframe. Je voudrais juste le corps html. Quelqu'un sait comment modifier en conséquence?corps html de iframe
code:
alert($("#uploaderIframe").contents()[0].documentElement.innerHTML);
Salut mon code retourne tout le html de l'iframe. Je voudrais juste le corps html. Quelqu'un sait comment modifier en conséquence?corps html de iframe
code:
alert($("#uploaderIframe").contents()[0].documentElement.innerHTML);
var iframeHtml = $("#uploaderIframe").contents()[0].documentElement.innerHTML;
var bodyHtml = $(iframeHtml).find("body").html();
alert(bodyHtml);
.. crée probablement un nouveau noeud DOM du innerHTML du iFrame - Je pense effectivement que $(iframeHtml).find("body")
est un vide jQuery objet.
Essayez
var bodyHtml = $('#uploaderIframe').contents().find("body").html()
Ref: Traversing/contents
Essayez ceci:
iframeHtml = $("#uploaderIframe").contents()[0].documentElement.innerHTML;
bodyHtml = $(iframeHtml).find("body");
parfait thankyou –