SOURCE

console 命令行工具 X clear

                    
>
console
<!DOCTYPE html>
<html>

<head>

</head>

<body style="">
	<h1>select2 test</h1>
	<select id="e15" multiple="true" style="width:100%">
        <option value="red">red</option>
        <option value="green">green</option>
        <option value="blue">blue</option>
        <option value="orange">orange</option>
        <option value="white">white</option>
    </select>
    <div id="e15_val"></div>

    <script>
        $("#e15").select2({clear:true});
        // $("#e15").select2({tags: ["red", "green", "blue", "orange", "white"]});

        $("#e15").on("change", function () {
            $("#e15_val").html($("#e15").val());
        });

        $("#e15").select2("container").find("ul.select2-choices").sortable({
            containment: 'parent',
            start: function () {
                $("#e15").select2("onSortStart");
            },
            update: function () {
                $("#e15").select2("onSortEnd");
            }
        });
	</script>

</body>
</html>