As the title, on selectize, how can I disabled typing except Backspace key.
It will be allowed to:
- Select item on dropdown.
- Delete selected items.
It will NOT be allowed to:
- Type or add any new items.
I have read the API document but I can't found the solution. Any suggestions.
Here mine:
var $select = $('#tags').selectize({
maxItems: 5,
persist: false,
createOnBlur: true,
create: true,
});
UPDATE:
I found the solution by my own
$select[0].selectize.$control_input.on('keydown', function(e) {
var key = e.charCode || e.keyCode;
if(key == 8 )
return true;
else
e.preventDefault();
});