bootstrap-typeahead.js在select事件上添加一个侦听器 [英] bootstrap-typeahead.js add a listener on select event

查看:64
本文介绍了bootstrap-typeahead.js在select事件上添加一个侦听器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Bootstrap Twitter框架的新手,我需要使用bootstrap-typeahead.js来实现自动完成,但还需要获取用户为typeahead选择的值.

I'm new to the Bootstrap Twitter framework, and I need to use bootstrap-typeahead.js for autocomplete but I need also to get the value selected by the user for the typeahead.

这是我的代码:

<input type="text" class="span3" style="margin: 0 auto;" 
                   data-provide="typeahead" data- items="4" 
                   data-source='["Alabama","Alaska"]'>

如何添加侦听器以从typeahead类型获取所选值并将其传递给函数?例如,当我使用ExtJs时,将应用以下结构:

How can I add a listener to get the selected value from type typeahead and pass it in a function? For example when I use ExtJs, I apply this structure:

listeners: {
   select: function(value){
     ........
   }
}

如何用预先输入做类似的事情?

How can I do something similar with a typeahead?

推荐答案

尝试此分叉.它为您提供了一个onselect事件,异步填充等等!

Try this fork of typeahead. It gives you an onselect event, asynchronous population and more!

这篇关于bootstrap-typeahead.js在select事件上添加一个侦听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆