title: jQuery autocomplete continuation instead of replace
body: <p>I am wondering how to make jquery append autocomplete choice to textbox when moving with arrows or pressing enter on choie instead of replacing the whole text in the text box?
  Here is my code so far:</p>
  
  <p>Server Side: </p>
  
  <pre><code>public ActionResult Autocomplete(string lang, string query)
          {
              try
              {
                  var term = query.IndexOf(',') &gt; 0 ? query.Substring(query.LastIndexOf(',') + 1).ToLower() : query.ToLower();
                  if (!String.IsNullOrWhiteSpace(term))
                  {
                      var data = context.Tags.Where(s =&gt; s.Name.StartsWith(term)).Select(x =&gt; x.Name).Take(5).ToArray();
                      return Json(data);
                  }
                  return Json(new string[] { });
              }
              catch
              {
                  return Json(new string[] { });
              }
          }
  </code></pre>
  
  <p>Client-side:</p>
  
  <pre><code> &lt;script type="text/javascript"&gt;  
    var tagsautocomplete = '@("/" + Url.RequestContext.RouteData.Values["lang"])/pictures/autocomplete';
      &lt;/script&gt;
  
   $("#submit_picture_tags").autocomplete({
          source: function (request, response) {
              $.ajax({
                  url: tagsautocomplete, type: "POST", dataType: "json",
                  data: { query: request.term },
                  success: function (data) {
                      response($.map(data, function (item) {
                          return { label: item, value: item };
                      }))
                  }
              })
          },
          minLength: 1,
      }); 
  </code></pre>