I’d like to add text “username” to textarea when some event is occurred, and this code works
$("textarea").append("username")
Exactly until I add some text to that textarea manually. How to avoid this behavior?
This is what I have on html source.
<a href="javascript:void(0)" onclick="javascript:add_to_textarea('User')">User</a>
Use
$("textarea").val($("textarea").val() + "username");