I want to implement this autocomplete to my page: http://www.bewebdeveloper.com/tutorial-about-autocomplete-using-php-mysql-and-jquery and it works but in my case I use clone()
function to copy all <li>
elements like here: http://jsfiddle.net/x42c3anw
When I have several inputs autocomplete works only for first input, how I can edit this function? :
function autocomplet() {
var min_length = 0; // min caracters to display the autocomplete
var keyword = $('#country_id').val();
if (keyword.length >= min_length) {
$.ajax({
url: 'ajax_refresh.php',
type: 'POST',
data: {keyword:keyword},
success:function(data){
$('#country_list_id').show();
$('#country_list_id').html(data);
}
});
} else {
$('#country_list_id').hide();
}
}
// set_item : this function will be executed when we select an item
function set_item(item) {
// change input value
$('#country_id').val(item);
// hide proposition list
$('#country_list_id').hide();
}
I undurstand this is because ID is not uniqe, is there possibility to add some increment to id or use class? If yes how I can do that?