typeaheadブートストラップを使用して、選択した値に関連する特定の値を設定するために、メニューから項目が選択またはフォーカスされたときにトリガーしたいと思います。
私が何を意味するのかを正確に理解するには、コードのコメントを参照してください。
element.typeahead({
minLength: 3,
source: function () {
// users is a Backbone.Collection
users = _.map(users, function(user) {
return user.get('first_name')+' '+user.get('last_name');
});
return users;
}
}).change(function (event) {
// this function which is called when the user set a value
// should be able to get the user.get('id') of the selected user
// any idea how to make it?
});