I have this script that does a search using Jquery autocomplete.
$( function($) {
$.ui.autocomplete.prototype._renderItem = function (ul, item) {
var t = String(item.value).replace(
new RegExp(this.term, "gi"),
"<strong>$&</strong>");
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a>" + t + "</a>")
.appendTo(ul);
};
$( "#p" ).autocomplete({
source: "php/search_palavras.php?id_cidade=<?php echo $id_cidade; ?>",
minLength: 2,
select: function( event, ui ) {
// Set autocomplete element to display the label
this.value = ui.item.label;
// Store value in hidden field
$('#hidden_p').val(ui.item.id);
// Prevent default behaviour
return false;
}
});
$( "#p" ).click(function() {
$('#hidden_p').val(0);
$('#p').val('');
});
});
Nearly everything is perfect. The only problem I'm having, I do not know if it's PHP or Jquery, but if I start a search with "aco", come the answers:
Butchers
S aco Hortifrutigrangeiros
Tourist Information Centers
Wholesale and Manufacture of S plastic s
I have tried every way, but I can not stress the "steel" or "steel" that are with cedilla and accents. Would it be possible to highlight these items as well?