I want to prevent the select2 from opening if you click directly on a tag. This kinda works but is buggy and looks dirty. Any better suggestions? Is there an originalEvent I can use? I can’t find one.
var tagClick = false;
$(document).on('mousedown', '.my-select2-tag-class', function(e) {
var $self = $(this);
tagClick = true;
});
$('#my-select2').select2(myOptions)
.on('select2:opening', function (e) {
var $self = $(this);
if( tagClick )
{
e.preventDefault();
$self.select2('close');
tagClick = false;
}
});