Javascript Twitter从句首开始提前键入匹配

Javascript Twitter从句首开始提前键入匹配,javascript,Javascript,我正在使用Twitter typeahead,我需要帮助来实现以下内容: 用户键入“移动”,数据集列表如下(is move to、move over、was move、move to) 我只想返回列表中的第2项和第4项,即仅从开始处匹配 谢谢。到目前为止你都试了些什么?你犯了什么错误?请共享一些代码变量选项suburbids=$('#options suburbids option').map(函数(){return$(this.text();}).get();var engineSuburb=

我正在使用Twitter typeahead,我需要帮助来实现以下内容:

用户键入“移动”,数据集列表如下(is move to、move over、was move、move to)

我只想返回列表中的第2项和第4项,即仅从开始处匹配


谢谢。

到目前为止你都试了些什么?你犯了什么错误?请共享一些代码变量选项suburbids=$('#options suburbids option').map(函数(){return$(this.text();}).get();var engineSuburb=new Bloodhound({name:'optionSuburbIDs',datumTokenizer:function(d){return Bloodhound.tokenizers.whitespace(d.val);},queryTokenizer:Bloodhound.tokenizers.whitespace,local:$.map(optionSuburbIDs,function(optionSuburb){return{val:optionSuburb};});engineSuburb.initialize();当我输入“move”时,所有项目都会返回,因为它们都包含单词“move”,我只想返回以单词“move”开头的项目