2009-10-30 6 views
0

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); 

Répondre

0
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

+0

parfait thankyou –

0

Essayez ceci:

iframeHtml = $("#uploaderIframe").contents()[0].documentElement.innerHTML; 
bodyHtml = $(iframeHtml).find("body"); 
Questions connexes