...

View Full Version : Preview Source Code In Iframe



angelali
11-04-2012, 05:13 PM
I have made a simple rich text editor project but very good one. I will upload it later and make people to download and use. It is my first open source project.

I have already made everything but one thing I cannot do, I mean I don't know how to proceed to do it or begin to do it, is how to preview the source code that the user has typed in the editor?

I hope you know what I mean here... Just like any rich text editor, there is a button to preview in HTML codes what the user has written.. If you can, give me a beginning..I will try to manage.. Thank!

rnd me
11-05-2012, 06:03 AM
alert(document.querySelectorAll("[contentEditable]")[0].innerHTML);

you may have to run this on an iframe's element.contentWindow if that's how your wysiwyg works.

angelali
11-05-2012, 07:06 AM
Thank...I solved it yesterday itself... It was just a question of innerHTML by getting the content of the iframe and use innertext to write it..



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum