I need to know how to make a "Quote this User" function using script for my forum software. Basically on my forum underneath each username will be a "Quote This User" link and that link will insert what that user posted into the text area box underneath the post.
The best way would be to put what the user said in a <div></div> and assign an ID to that. Then when the users clicks "Quote This User" take the text from the DIV and transfer to the textarea. Something like this: <script type="text/javascript"> function transfer(){ var post = document.getElementById('user_post').innerHTML; document.getElemenyById('new_post').value = post; } </script> <div id="user_post">This is the users Post here</div> <input type="button" onclick="transfer();" value="Quote This User" /> <textarea id="new_post"></textarea> Code (markup): Sorry for my sloppy code, it is just an example.
Btw I found the typo that you wrote elemeny instead of element. I'm also happening to use tinymce and your code only works when tinymce is disabled. Is there anyway to make it work WITH tinymce?