Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
  <link rel="stylesheet" href="https://cdn.bootcss.com/select2/4.0.1-rc.1/css/select2.min.css
">
  <script src="https://cdn.bootcss.com/select2/4.0.1-rc.1/js/select2.full.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  
<label for="taglist">添加标签</label>  
<input id="taglist" type="select" class="taglist form-control">
</body>
</html>
 
        $(function () {
          
          data = $(".taglist").select2({
                placeholder: "添加标签",
                multiple: true,
                ajax: {
                    url: "/api/taglist",
                    dataType: 'json',
                    results: function (data) {
                      data = {
                        "1" : "1",
                        "2" : "2"
                      };
                    return {results: data};
                    },
                    cache: true
                }
            });
        });
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
dingyimingpro
0viewers