After I add a autocomplete to an element like:
commObj=$("#communityName").autocomplete("auto_commName_backend.php",
{'onItemSelect': handleItemSelect}, {'extraParams': 'ndo' + ndo});
Is there a way I could disable it or remove the autocomplete for the element dynamically?
I am using modified jquery autocomplete plugin from Dylan Verheul. http://www.pengoworks.com/workshop/jquery/autocomplete_docs.txt
The jQuery UI Autocomplete destroy() method is used to remove the autocomplete functionality completely from the widget. This method does not accept any parameter and returns the element back to its pre-init state. Syntax: $( ".
Autocomplete attribute of HTML is use to fetch previous input values in input fields. Almost all browsers supports autocomplete attribute, by default this attribute is “on” in html. If you want to disable this attribute ,you can set autocomplete=”off” in html input tag.
If the autocomplete feature is enabled but still not working, try disabling the account sync feature in the You and Google tab as mentioned previously. Click on Turn off to the right of your name and email address. Then restart Google Chrome and enable sync again.
You can remove the autocomplete behaviour by using following line of code:
if (jQuery(control).data('autocomplete')) {
jQuery(control).autocomplete("destroy");
jQuery(control).removeData('autocomplete');
}
The easiest and safest way I found is:
$(control).autocomplete({source: []});
Alternatively, as mentioned before this also works:
$(control).autocomplete("destroy");
If you are sure your control has an autocomplete handler set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With