TypeError: $(…).autocomplete is not a function – bootstrap-autocomplete
I encountered this issue, autocomplete is not a function. I had used the bootstrap-autocomplete plugin.
I had imported the bootstrap autocomplete javascript file to my project. Then what can be the reason for this error “TypeError: $(…).autocomplete is not a function”.
Autocomplete is not a function (Solution)
Here is the solution for this error. I forgot to import the jquery ui library which caused this error and unfortunately I did not find this dependency requirement in the official bootstrap-autocomplete documentation.
The following steps can ensure the solution,
- Import the jquery UI library file or use CDN for this.
- Import the bootstrap-autocomplete file or use CDN for this.
The order of importing the above files should be the same as given above. Because bootstrap-autocomplete needs the jquery UI as its dependency.