我想要一个选择列表,可以选择取消选择的值。
<label for="ticket_status" class="control-label">Ticket Status:</label>
<select class="js-basic-ticket-status">
</select>
ticket_status = [{"id":"Cancelled","text":"Cancelled"},{"id":"Closed","text":"Closed"},{"id":"Completed","text":"Completed"},{"id":"Draft","text":"Draft"},{"id":"Implementation In Progress","text":"Implementation In Progress"},{"id":"Planning In Progress","text":"Planning In Progress"},{"id":"Rejected","text":"Rejected"},{"id":"Request For Change","text":"Request For Change"},{"id":"Scheduled","text":"Scheduled"},{"id":"Scheduled For Approval","text":"Scheduled For Approval"},{"id":"Scheduled For Review","text":"Scheduled For Review"}];
$(".js-basic-ticket-status").select2({
placeholder: "Select Status",
/*initSelection: function(element, callback) {
},*/
allowClear: true,
data: ticket_status,
//multiple: true,
closeOnSelect: false,
});
我可以在右上角看到'x',但点击时没有任何反应。