I currently have a select2 dropdown, version 4.0, that allows the selection of items as well as free text to be typed.
$("#dropdown").select2({
placeholder: "Select or enter a new item",
allowClear: true,
tags: true
});
I understand that typing free text creates a new option that can be clicked or will appear as an entry if the return key is pressed.
However clicking the newly entered option or hitting return are the ONLY ways for it to be accepted. This seems a little unintuitive as I know users will want to click onto other form elements or tab through the form.
Is there a way to allow a tag to be created just from de-focusing the form element?
I'm thinking something along the lines of having a .blur()
event fire a selection or have select2:close
cause a selection but I can't quite put it together.