Search code examples
javascriptjqueryiframedesignmode

Can't get value of designMode IFRAME


I can't retrieve the contents of an iframe, when designmode = 'on'. Here is my code:

val = $("#frame").val();

I've tried everything, and nothing works, help?


Solution

  • var iframe = $("#frame")[0];
    var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
    var val = iframeDoc.body.innerHTML;