SyntaxError when filling in a '[' in the typeahead text box
Error details:
bootstrap-typeahead.js:147
SyntaxError: Invalid regular expression: missing terminating ] for character class
Fill in, for example '[tng'
My code:
$('#search').typeahead({
source:function (typeahead, query) {
if($('#search').val().length < 3)
return;
$.getJSON('/players/get/' + $('#search').val(), function (data) {
if (data == null)
return;
var items = [];
for (var i in data['options']) {
items.push(data['options'][i]);
}
typeahead.process(items);
});
}
});