text 自動輸入

  • 45
  • 0

text 自動輸入: https://jqueryui.com/autocomplete/

輸出冒號  @Html.Raw("\"")

text 自動輸入: https://jqueryui.com/autocomplete/

輸出冒號  @Html.Raw("\"")   http://www.cnblogs.com/kimisme/p/4209128.html

 

<script>
    $(function () {

    var availableTags = [
      "ActionScript",
      "AppleScript",
      "Asp",
      "BASIC",
      "C",
      "C++",
      "Clojure",
      "COBOL",
      "ColdFusion",
      "Erlang",
      "Fortran",
      "Groovy",
      "Haskell",
      "Java",
      "JavaScript",
      "Lisp",
      "Perl",
      "PHP",
      "Python",
      "Ruby",
      "Scala",
      "Scheme",
      @foreach (var item in ViewBag.UserList)
      {
     @Html.Raw("\""+item.user_ID+"-"+item.userName+"\",");
      }
    ];
    $("#tags").autocomplete({
          source: availableTags
      });
  } );
</script>

<div class="ui-widget">
    <label for="tags">Tags: </label>
    <input id="tags">
</div>