1

Topic: How to programmatically add text at the end of textarea

Hello!

I am trying to build a plugin that would add text at the end of the textarea. Let's say the plugin will add: Author: [Authorname]
I would like to make it so that the text is always added at the end of the input.
So even if the user is still writing, I would like to place the Author at the end of what he's writing. I'm currently using:

..... Event that fires the code ....
 tinyMCE.execInstanceCommand("content", "mceInsertContent", false, "<div style='width: 100%;'><br /> <br /> <hr /> <h3 align='center'>Author name: "+author.name+"</h3> <br /> <br /></div>")

This does not add the text at the end. It adds it in front of the content.
Is it possible to place the autor at the end?

Thanks!

Last edited by nejko15 (2012-05-24 15:36:18)

2

Re: How to programmatically add text at the end of textarea

tinymce.activeEditor.getBody().appendChild(tinymce.activeEditor.dom.create('div', {}, '<b>HELLO</b>'));

Best regards,
Spocke - Main developer of TinyMCE

3

Re: How to programmatically add text at the end of textarea

Thank you!
Works like a charm!

Last edited by nejko15 (2012-06-03 11:32:22)