Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    333
    Thanks
    38
    Thanked 0 Times in 0 Posts

    Preview Source Code In Iframe

    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!

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,277
    Thanks
    10
    Thanked 581 Times in 562 Posts
    Code:
    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.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #3
    Regular Coder
    Join Date
    Sep 2011
    Posts
    333
    Thanks
    38
    Thanked 0 Times in 0 Posts
    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..


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •