如果您使用谷歌浏览器访问我的网站http://djdavid98.zymichost.com/.tagguide/并尝试使用搜索框(例如输入“a”,单击第一个选项),您将在控制台中看到, jQuery 记录一个Uncaught TypeError: Cannot call method 'toLowerCase' of undefined
. 我不明白为什么。
问题一定出在这部分代码中,因为删除它可以解决所有问题:
tagguide.js(第 20-46 行):
$('#findname').typeahead({
...
updater : function (item) {
$('#ponies li:contains('+$(this).val()+')').parent().parent().parent().addClass('in');
...
},
});
$('#findpony').typeahead({
...
updater : function(item){
$('#'+$('div.accordion-group > div > a.accordion-toggle:contains('+$(this).val()+')').attr('id')).addClass('in');
...
},
});