autocomplete-lite-img is a lightweight JQuery-based autocomplete plugin. It supports images and callback functions.
- Load JQuery library
- Load autocomplete-lite-img.js library
- Initialize autocomplete on element and pass items, images ( and callback function )
$('#jquery_object').autocomplete_img_init({
items: item_data_array,
images: image_data_array,
callback: callback_function
});
NOTE : in your callback function, the first and the second arguments are your_input_element
and selected_item_index
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="autocomplete-lite-img.js"></script>
<input type="text" id="autocomplete_input">
<script>
// initializing
$('#autocomplete_input').autocomplete_init({
items: ["aaa", "bbb", "ccc", "ddd", "eee", "fff"],
images: ["aaa.jpg", "bbb.jpg", "ccc.jpg", "ddd.jpg", "eee.jpg", "fff.jpg"],
callback: callback_function // this argument is optional
});
function callback_function(elem, index)
{
alert("Selected : " + elem.val() + '. Item index : ' + index);
}
</script>
If you want to report a bug or want to add a sugestion, just add it in the issues. Or you can mail me at this.
The license is available within the repository in the LICENSE file.