选择 Selectize.js 字段后如何关注下一个字段

How to focus on next field after selecting Selectize.js field

我如何在 select 来自 selectize.js select 元素的项目后聚焦到下一个元素?我在 selectize.js 中没有找到 onSelect 选项。 Note:my下一个元素也是selectize.jsselect元素

您可以在第一个 select-box 上使用 change 事件。然后,每当 first-select box 发生变化时,使用 selectize 的实例并为第二个 select-box 调用 .focus()

演示代码 :

var $select = $('#a').selectize();
var $select2 = $('#b').selectize();
// get instance
var selectize = $select[0].selectize;
var selectize2 = $select2[0].selectize;
//on change of first select or use blur event
selectize.on('change', function onChange() {
  selectize2.focus() //focus second one 
});
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.8.5/css/selectize.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.8.5/js/standalone/selectize.min.js"></script>
<select id="a">
  <option value="1">A</option>
  <option value="3">N</option>
</select>
<select id="b">
  <option value="1">A</option>
  <option value="22">Ar</option>
</select>