0

I'm trying to add and remove a focus class to selectize but i can't seem to get it to work at all when navigating using a keyboard only. It works fine when using a mouse.

var focusEvent = function () {
  return function() {
    $("div.selectize-input").addClass('my-custom-focus-class')
  }
}

var blurEvent = function () {
  return function() {
    $("div.selectize-input").removeClass('my-custom-focus-class')
  }
}


$("#my-select-element").selectize([
  onFocus: focusEvent(),
  onBlur: blurEvent(),
  openOnFocus: false,
  max_item: null,
  plugin: ['remove_button']
])

The problem seems to be that the blur event is not called when tabbing forward(tab). When tabbing backward(shift+tab) both the focus event and the blur event are never called.

0

Browse other questions tagged or ask your own question.