【问题标题】:how to get the dataset name and textfield value in typeahead.js如何在 typeahead.js 中获取数据集名称和文本字段值
【发布时间】:2013-12-04 23:33:08
【问题描述】:

我正在使用 twitter typeahead.js 和 bootstrap 3.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>'
}

【问题讨论】:

    标签: javascript html twitter-bootstrap typeahead.js


    【解决方案1】:

    添加

    template: 'Region - {{value}}'

    到第一个数据集,并且

    template: 'Country - {{value}}'

    到第二个数据集。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-02
      • 2010-10-25
      • 1970-01-01
      相关资源
      最近更新 更多