I have a div which contains various unknown inputs. Some of these inputs may or may not be registered as jqueryui autocomplete text inputs. How can I find the autocomplete objects that are registered and destroy them using the .autocomplete(‘destroy’) method?
Share
Method 1
The jQuery UI widgets (and other ones) built using the Widget Factory automatically defines a pseudo-selector:
and it will get the inputs that have an autocomplete instance attached.
Please note that is only working with widgets built using the jQuery UI Widget Factory (and others that explicitly implement such behavior). Inside the jQuery UI library, a few widgets does not implement this factory, like Datepicker for instance, but Autocomplete does.
Method 2
The autocomplete plugin adds a css class `.ui-autocomplete-input’ to the input fields that have been initialized by the plugin, so you can also do: