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 4 of 4
  1. #1
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,182
    Thanks
    174
    Thanked 257 Times in 257 Posts

    Mirroring text in an input, to anothe input/div in Tiny MCE

    I am trying to create an editor that will allow a user to type in words in a text input. This text input will pace the text in a div in real time.

    example:Edit fiddle - JSFiddle

    Only problem is, that for some reason tinyMCE does not like outside sources unless loaded with PHP.

    Is there a way to do what I posted and work? Or is it not possible because it is in an iframe? Below is what I have but it will not work.

    Code:
    <script type="text/javascript">
    tinymce.init({
        mode : "specific_textareas",
        editor_selector : "mceEditor",
        selector: "textarea",
        menubar:false,
        plugins: [
            "advlist autolink lists link image charmap print preview anchor",
            "searchreplace visualblocks code fullscreen",
            "insertdatetime media table contextmenu paste"
        ],
        toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify"
    });
    </script>
    
    <form method="post" action="dump.php">
        <textarea class="mceEditor" name="content">
       <div style="width:300px; height:100px;" id="_address1"></div>
        </textarea>
    </form>
           
    <script>
    var jqj = jQuery.noConflict();
    jQuery(function (jqj) {   
    jqj('#address').keyup(function () {
            jqj('#_address1').text(jqj('#address').val());
        });
    });
    </script>

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,983
    Thanks
    56
    Thanked 557 Times in 554 Posts
    your fiddle works fine for me, or perhaps I am not understanding the problem?

  • #3
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,182
    Thanks
    174
    Thanked 257 Times in 257 Posts
    Fiddle works fine, yes. The issue is that when I try to implement this into TinyMCE it will not work. Not sure if it is because it uses an iframe, but non the less it does not want to talk to anything outside of Tiny MCE. Hopefully that explains it better.

    edit: new MCE fiddle: http://fiddle.tinymce.com/Eleaab
    Last edited by jcdevelopment; 06-25-2014 at 06:09 PM.

  • #4
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,983
    Thanks
    56
    Thanked 557 Times in 554 Posts
    I think the problem is that you are putting a span inside a textarea which does not at all seem to me to be valid html. You are also referencing '#address' but I'm pretty sure you mean '#address1'


  •  

    Tags for this Thread

    Posting Permissions

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