Twitter bootstrap 如何在Typeahead.js中忽略模板的突出显示部分?
我正在使用和引导css。我的模板如上面的第一个链接所示,如下所示:Twitter bootstrap 如何在Typeahead.js中忽略模板的突出显示部分?,twitter-bootstrap,typeahead.js,bloodhound,Twitter Bootstrap,Typeahead.js,Bloodhound,我正在使用和引导css。我的模板如上面的第一个链接所示,如下所示: $(function() { cropsSuggestionEngine.initialize(); $('#select-crop .typeahead').typeahead({ hint: true, highlight: true, minLength: 1 }, { name: 'Gewassen', displ
$(function() {
cropsSuggestionEngine.initialize();
$('#select-crop .typeahead').typeahead({
hint: true,
highlight: true,
minLength: 1
}, {
name: 'Gewassen',
displayKey: 'name',
source: cropsSuggestionEngine.ttAdapter(),
templates: {
empty: ['<div class="empty-message">','Niets gevonden...','</div>'].join('\n'),
suggestion: Handlebars.compile('<p><strong>{{name}}</strong> in {{category}}<br/>'
+ 'Ras: {{race}}.<br/>'
+ '<i>Groeitijd: {{growingTime}} maanden.</i><br/>'
+ '<input type="hidden" name="selected-crop-id" value={{id}}></p>')
}
});
});
$(函数(){
cropsSuggestionEngine.initialize();
$('#选择crop.typeahead')。typeahead({
提示:没错,
推荐理由:没错,
最小长度:1
}, {
名称:“格瓦森”,
displayKey:'名称',
来源:cropsSuggestionEngine.ttAdapter(),
模板:{
空:['','Niets gevonden…',''。加入('\n'),
建议:handlebar.compile(“{{{name}}在{category}}
”
+'Ras:{{race}}.
+'Groeitijd:{{growingTime}}maanden.
+“”)
}
});
});
不幸的是,模板中匹配的所有元素都被高亮显示,因为当它们被选中时,它们得到了“tt highlight”css类。见:
在页面的HTML中会发生以下情况:
Groeitijd: 2 m
<strong class="tt-highlight">a</strong>
<strong class="tt-highlight">a</strong>
nden.
Groeitijd:2米
a
a
邓恩。
我不希望模板中的Groeitijd:{{{growingTime}}
部分出现这种高亮度。我知道如何删除所有突出显示,但不知道如何删除模板中某个特定部分的突出显示
有人知道如何做到这一点吗?非常感谢。修复了这个问题,在我不想突出显示的部分添加了一个类no highlighting,如下所示:
<i class="no-highlighting">Groeitijd: {{growingTime}} maanden.</i><br/>
.no-highlighting strong {
font-weight:normal;
}