Twitter Bootstrap typeahead 获取 id post 数据



我正在使用Twitter Bootstrap typeahead,按照这个例子。

var mySource = [{ id: 1, name: 'Terry'}, { id: 2, name: 'Mark'}, { id: 3, name: 'Jacob'}];
$('#myElement').typeahead({
    source: mySource
});

我需要在提交时将所选"名称"的"id"写入表中。它正在尝试在提交时将"名称"写入表,我不确定还能尝试什么。有什么想法吗?

bootstrap typeahead 的功能非常小。如果不修改插件的源代码,就无法完成您想要的事情。

相反,您可以使用 Select2 进行引导,它可以开箱即用。 http://ivaynberg.github.com/select2/

最新更新