I'm using renderItem to highlight words from search input, but i need on some way to ignore last spaces.
For example
var term = '123';
result
123 456
456 123
But if
var term = '123 ';
Than will highlight only
123 456
456 123
And i need to highlight 123 everywhere or in some way to ignore spaces in term
This is function.
_renderItem: function (ul, item) {
var newlabel = String(item.value).replace(
new RegExp(this.term,"ig"),
"<strong>$&</strong>");
return $("<li></li>")
.data("item.autocomplete", item)
.append("<div>" + newlabel + "</div>")
.appendTo(ul);
}