jquery-typeahead 在选择条目时隐藏建议框

jquery-typeahead hide suggestion box on choosing an entry

我正在玩 jquery-typeahead 的第一个演示示例 "Country v1" 来自:http://www.runningcoder.org/jquerytypeahead/demo/

$.typeahead({
  input: '.js-typeahead-country_v1',
  minLength: 1,
  order: "desc",
  dynamic:true,
  source: {
    data: data
  },
  callback: {
    onInit: function(node) {
      console.log('Typeahead Initiated on ' + node.selector);
    }
  }
});

https://jsfiddle.net/qz7dfsku/

当我select其中一个选择时,我试图让建议框消失。

似乎添加 dynamic: true 会破坏它,如果我将其设置为 false 则它会起作用。

知道这里会发生什么吗?

已在 2.10.2 中修复。

https://github.com/running-coder/jquery-typeahead/issues/380

"that's an unwanted behaviour because of an extra request being sent #381 when the item is selected, will patch that asap"

https://github.com/running-coder/jquery-typeahead/issues/381