title: Append jQuery autocomplete data to textarea content instead of overwriting it
body: <p>I am trying to make a <code>@</code> other people function in my rails app, just like stackoverflow:</p>
  
  <p><a href="https://i.stack.imgur.com/75plH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/75plH.png" alt="enter image description here"></a></p>
  
  <p>I've almost finished this function, but I encounter problems, the jQuery auto-compelete data replace my textarea content, not append.</p>
  
  <p><a href="https://i.stack.imgur.com/x7kdY.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x7kdY.gif" alt="enter image description here"></a></p>
  
  <p><strong>Coffeescript:</strong></p>
  
  <pre><code>find_at_sign = -&gt;
    if $("#tags").val().split('').pop() == "@"
      id = $("#tags").data("article-id")
      $("#tags").autocomplete
        source:  '/articles/' + id + '/autocomplete.json'
        minLength: 1
  
  $ -&gt;
    $(document).on("input", "#tags",
    -&gt; find_at_sign())
  </code></pre>
  
  <p><strong>Article Controller:</strong></p>
  
  <pre><code>  def autocomplete
      @articles = Article.find_by(id: params[:article_id])
      @commentor_names = @articles.comments.map(&amp;:name).uniq
      respond_to do |format|
        format.html
        format.json {
          render json: @commentor_names
        }
      end
    end
  </code></pre>
  
  <p><strong>form_html.erb:</strong></p>
  
  <pre><code> &lt;div class="form-group ui-widget"&gt;
      &lt;div class="col-sm-5"&gt;
        &lt;%= f.text_area :content, rows: 5, placeholder: '说点什么...', 
            class: 'form-control', id: "tags", 'data-article-id': @article.id.to_s %&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>I tried to use <code>append</code> method, but doesn't work:</p>
  
  <pre><code>$("#tags").append(${this).autocomplete
    source:  '/articles/' + id + '/autocomplete.json'
    minLength: 1)
  </code></pre>
  
  <p>Any help is appreciate！</p>