[jQuery] [autocomplete] remove dynamically

[jQuery] [autocomplete] remove dynamically


Hi,
How do I remove autocomplete from the text box dynamically. I have a
text box that will perform two kinds of searches depending on the
context (don't ask me why, beyond my control). I need to remove
previous autocomplete and attach new one. Difference is in the url
that it goes against. Or maybe there is a way to change Url and some
options dynamically?
I've been trying this with no luck. It just keeps adding new
autocompletes. This is markup after binding in aspx page.
$("#rbClientName").click(
function() {
debugger;
$("#ctl00_mainBody_txtClientNumber").unbind
("autocomplete");
//clear text and focus
$("#ctl00_mainBody_txtClientNumber").val("").focus
();
//attach autocomplete to txtClientNumber text box
$("#ctl00_mainBody_txtClientNumber").autocomplete
('ws://../WebServices/ClientSearch.asmx/GetClientNameSearchResults', {
multiple: false,
minChars: 3,
max: 100,
mustmatch: true,
scroll: false,
highlight: function(value, term) { return
value; },
formatItem: function(item) {
return format(item);
}
})