I'm using Select2 to create a Gmail-style e-mail addresses field in my application. It works great except for one case: when the user types in an e-mail address and doesn't put a space or comma after it, and doesn't hit enter or tab. For example, if they just type an e-mail address and then use the mouse to select the next field in the form, the e-mail address they typed goes away.
I have an example jsfiddle here that illustrates the problem.
Here's how I'm setting up select2 on my hidden input:
$(function(){
$('input').select2({
tags: [],
width: "300px",
dropdownCss: {display: 'none'},
tokenSeparators: [',', ', ', ' ']
});
});
Is there a way for me to set up select2 so that onBlur it just takes whatever is left and is not currently a tag and makes it one?