hi I was working on comments module where i pull of the usernames and insert them into a text area when i click a button.
Now I want the cursor to point to the end of the username everytime i click the button. I tried using the focus() property but it takes me to the beginning of the text area.
here is my code so far:
Now I want the cursor to point to the end of the username everytime i click the button. I tried using the focus() property but it takes me to the beginning of the text area.
here is my code so far:
Code:
<script type="text/javascript"> function setComments(userID) { document.getElementById("comments_content").value = document.getElementById("comments_content").value + userID + "\n\n"; } </script>
Code:
<a onclick="setComments('<?php print $comment_username; ?>') + document.edit.comments_content.focus()" href="#addcomment"> <img src="images/reply-button.png" align="top" border="0"> </a>
Code:
<textarea class='comment-input-textarea-loggedin' id='comments_content' name='comments_content'></textarea>
Comment