Veljean
asked on
Overwrite values on Autocomplete jquery ...
Hi
I have a DropDownlist of country states, when i select a state i want to populate a autocomplete editbox with jquery with all the posible results so the user can find the correct city in the current state. Till now i coded the following...
$(document).ready(function (){
//result is an array opf all the posible values...
$("#AutoCompleteText").aut ocomplete( result, {
matchContains: true,
minChars: 0
});
And it works nice but the problem is when i pick another different state, all the old locations remain in the memory (it seems that jquery appends all the new items), i want to overwrite them!!
Can i reset all the values of the autocomplete editbox in jquery?
});
I have a DropDownlist of country states, when i select a state i want to populate a autocomplete editbox with jquery with all the posible results so the user can find the correct city in the current state. Till now i coded the following...
$(document).ready(function
//result is an array opf all the posible values...
$("#AutoCompleteText").aut
matchContains: true,
minChars: 0
});
And it works nice but the problem is when i pick another different state, all the old locations remain in the memory (it seems that jquery appends all the new items), i want to overwrite them!!
Can i reset all the values of the autocomplete editbox in jquery?
});
ASKER
hi shahzadfatehali
I did that before but the autocomplete field appends the new informations instead of rewrite them...
I did that before but the autocomplete field appends the new informations instead of rewrite them...
Can you post your code here?
ASKER
Sorry for the late answer ...
i dont have any relevant code , but here it is...
i dont have any relevant code , but here it is...
function ObtenerLocalidades()
{
var ddlstate = document.getElementById("DDEstados");
var state = ddlstate.selectedIndex;
if (ddlstate.selectedIndex!=0)
{
PageMethods.GetAutoTextLocations(state,OnComplete,onError);
}
}
function OnComplete(result)
{
$(document).ready(function(){
$("#AutoCompleteText").autocomplete(result, {
matchContains: true,
autoFill: false,
minChars: 0
});
});
}
function onError()
{
alert("Fail")
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
$("#AutoCompleteText").aut
matchContains: true,
minChars: 0
});
where result is the list of cities.