[jQuery] autocomplete question
I am looking at the auto-complete demo page, (
http://view.jquery.com/trunk/plugins/autocomplete/demo/ ) on the demo
of remote images.
the Javascript for that is
$("#imageSearch").autocomplete("images.php", {
width: 320,
max: 4,
highlight: false,
scroll: true,
scrollHeight: 300,
formatItem: function(data, i, n, value) {
return "<img src='images/" + value + "'/> " + value.split(".")[0];
},
formatResult: function(data, value) {
return value.split(".")[0];
}
});
my problem is that when I try to implement this. it will only search
for the data that is first in the string. so if I have a "<span>" +
data.N "</span> I have to type in <span> to see any results, how to I
configure this to just match the data.N ?
function getEmpSuccess(data){
eval("empColl = " + data + ";");
$("input[id$='query']").autocomplete(empColl["E"], {
formatItem: function(data) {
var rts = data.N;
rts +='<div class="color' + data.W + '"> </div><br />';
rts += "<sub>" + data.S + "</sub>";
return rts;
},
formatResult: function(item, value) {
return item.N;
},
selectFirst: false,
max: 5
});
}