实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<link href="//cdn.bootcss.com/select2/3.5.4/select2.min.css" rel="stylesheet"/>
2
<script src="//cdn.bootcss.com/jquery/1.7.1/jquery.min.js"></script>
3
<script src="//cdn.bootcss.com/select2/3.5.4/select2.min.js"></script>
4
<style>
5
img {
6
    width:100px;
7
    height:100px;
8
}
9
</style>
10
<input type="hidden" class="bigdrop" id="e6" style="width:600px" value="" />
11
<script>
12
    $("#e6").select2({
13
        placeholder: "Search for a repository",
14
        minimumInputLength: 1,
15
        ajax: { // instead of writing the function to execute the request we use Select2's convenient helper
16
            url: "https://api.github.com/search/repositories",
17
            dataType: 'json',
18
            quietMillis: 250,
19
            data: function (term, page) {
20
                return {
21
                    q: term, // search term
22
                };