I want to give the user an autocomplete inputfield (with image in result) which searches a folder, /devices, filled with GIF's "AAU01-010.gif", "AAU01-020.gif".
I want them to be able to search on the name of the files. Since i couldn't find anything on the internet, is this possible, if so, how?!
P.S. I took underlying code from another example online, still need to change it to my needs $(function() {
$("#my_ac").autocomplete({
source: [
{
value: "Tom Hanks",
label: "Tom Hanks",
description: "Actor",
image: "hanks.png"
},
{
value: "Termionator 2",
label: "Termionator 2",
description: "Movie",
image: "terminator.png"
}
],
minLength: 1
}).data( "ui-autocomplete" )._renderItem = function( ul, item ) {
var inner_html = '<a><div class="list_item_container"><div class="image"><img src="' + item.image + '"></div><div class="label">' + item.label + '</div><div class="description">' + item.description + '</div></div></a>';
return $( "<li></li>" )
.data( "item.autocomplete", item )
.append(inner_html)
.appendTo( ul );
};
});
HTML
<h3>Ref_Devices</h3>
<div style="height:300px;">
<input type="text" id="my_ac"/>
<div class="list_item_container">
<div class="image"><img src=""></div>
<div class="label"></div>
<div class="description"></div>
</div>