The*_*est 6 typeahead twitter-bootstrap
我需要在Twitter Bootstrap Typeahead插件中设置匹配器,以区分大小写.Bootstrap文档指定需要将函数传递给typeahead选项,但不指定该函数应该是什么.
如果有人能告诉我怎么做,我将不胜感激.
提前致谢 :)
matcher是typeahead函数参数中的一个选项.从文档:
用于确定查询是否与项匹配的方法.接受单个参数,即用于测试查询的项目.使用this.query访问当前查询.如果查询匹配,则返回布尔值true.
所以,它看起来像这样:
$('.typeahead').typeahead({
matcher: function(item) {
// Here, the item variable is the item to check for matching.
// Use this.query to get the current query.
// return true to signify that the item was matched.
return true
}
})
Run Code Online (Sandbox Code Playgroud)
它还在文档中说这个回调的默认行为是case insensitive匹配器.因此,您的需求应该是开箱即用的.
| 归档时间: |
|
| 查看次数: |
6862 次 |
| 最近记录: |