filterValue 更改列表 jQuery Typeahead Search

filterValue change listiner jQuery Typeahead Search

我在我的项目中使用了 jquery typeahead。我想在值更改时获取 filterValue 的值。

例如,当点击县时,得到选定的值(即国家):

$('div.typeahead-container').on('change', 'span.typeahead-filter-value', function(event){
    alert($(this).val());
});

编辑:感谢您的重播。这是jsfiddle link,但别运行漂亮

你可以这样做

$('div.typeahead-container').on('click', '.input-group-btn li', function (event) {
    alert('okay');
});

runningcoder 正在为下拉菜单使用 bootstrap 布局,默认情况下 bootstrap 不提供下拉项点击事件。

这里是updated demo

希望对您有所帮助。