Input with autocomplete Jquery and xajax addAssign
Hello everybody !
I have a problem with an autocomplete function in Jquery on an element of the Dom that appears/disappears with a xajax function addAssign.
The input with id 'destinations' is load at the beggining in a gloabl div and the function autocomplete works perfect. But when i change the content of the div with the addAssign function by clickling on a different tab and replacing this input by the same input with the same id the autocomplete doesn't work anymore !
I understand why, because it's a new created element of the DOM after the document.ready(), but i don't know how i can do to make it works.
I put a sample of my code :
Jquery----------------------
$(document).ready(
function()
{
$("#destinations").autocomplete("../../../librairie/js/moteur_recherche_v3/ajax/autocomplete_destinations.php", {
extraParams: {code_pays2:function (){return $("#code_pays").val()}},
width: 260,
max:20,
autoFill:true,
minChars:2,
scroll:true,
scrollHeight:400,
selectFirst: false,
formatItem: function(data, value) {
return data[0] + ' (' + data[2] + ')';
}
});
$("#destinations").result(function(event, data, formatted) {
if (data)
$('#hebergement').val("");
$("#station").val(data[0]);
$('#select_station').val(data[1]);
$('#code_station_4d').val(data[1]);
/*$('#zone').val(data[2]);*/
$('#list1').val(data[3]);
$('#site_geo_4d').val(data[3]);
});
}
);
Can i recall the function autocomplete after my xajax addAssign ?
Thanx
