Javascript 如何在typeahead.js中获取数据集名称和文本字段值

Javascript 如何在typeahead.js中获取数据集名称和文本字段值,javascript,html,twitter-bootstrap,typeahead.js,Javascript,Html,Twitter Bootstrap,Typeahead.js,我正在使用TwitterTypeahead.js和Bootstrap3.0。我有一个input type=“text”和一个搜索按钮。我还有两个数据集 { name: 'Regions', local: ["Americas","APAC","EMEA","USA","Mexico","India","China","Malaysia","Belgium"], header: '<h3 class="myclass">Regions</h3>' }, {

我正在使用TwitterTypeahead.js和Bootstrap3.0。我有一个
input type=“text”
和一个搜索按钮。我还有两个数据集

{
  name: 'Regions',
  local: ["Americas","APAC","EMEA","USA","Mexico","India","China","Malaysia","Belgium"],
  header: '<h3 class="myclass">Regions</h3>'
},
 {
  name: 'Countries',
  local: ["India","USA","Brasil","China"],
  header: '<h3 class="myclass">Clusters</h3>'
}
当我搜索并单击搜索按钮时,我想在文本字段中获取数据集名称和值。如何获取文本字段值和数据集名称?(例如,每个数据集中的值可以相同,如下所示,USA在两个数据集中重复)

{
名称:'地区',
本地:[“美洲”、“亚太地区”、“欧洲、中东和非洲”、“美国”、“墨西哥”、“印度”、“中国”、“马来西亚”、“比利时”],
标题:“区域”
},
{
名称:'国家',
当地:[“印度”、“美国”、“巴西”、“中国”],
标题:“集群”
}
添加

template:'Region-{{{value}}'

到第一个数据集,以及

模板:'Country-{{value}}'

到第二个数据集