Reputation: 312
I am using select2, but i can not re-select selected item, so what i am doing is to clean select2 drop down menu when any item is selecting, is their any better solution ?
$('#selectBox').select2('destroy').val('').select2();
Upvotes: 1
Views: 66
Reputation: 14570
You can simply use this val()
and select to null with an change
function to reset your select2 seelected value when you click close
User clicks close button add this in your close function:
$("#selectBox").val('').change();
If user click outside the modal (Auto hide) Use this code:
$(document).click(function() {
$("#selectBox").val('').change();
}
Upvotes: 1