I have a select2 box, an I was to limit this to accept only email addresses.
I am trying to do this by writing a custom formatSelection
function, as
formatSelection: function(object, container){
if(validateEmail(object.text)){
return object.text;
}
else{
return "";
}
}
I am expecting that returning an empty string would be enough to not show this input in select2
, but I am getting an empty result.