Skip to content
Advertisement

JQuery .autocomplete not found?

I am trying to give my search bar autocomplete function.

JavaScript
JavaScript

I am getting this error:

JavaScript

Advertisement

Answer

The jQuery (or any javascript API in general) API might not be found for a various number of reasons.

Usually the problem is caused by the jQuery javascript code not being loaded at the moment your script executes. This can be due to a various number of reasons:

  • An adblocker might have blocked the jQuery javascript file
  • The jQuery javascript file is hosted on a CDN / other server that is offline
  • You loaded jQuery, but forgot to include jQuery UI (autocomplete is part of jQuery UI!)
  • Your code was executed before jQuery was loaded.
    This can be caused because your <script>$(document).ready(/*whatever*/);</script> code is located before the <script src="/path/to/jquery.js"></script> block, or alternately because you mistakenly made the jquery script tag async. So, make sure that:
    1. the jQuery script tag is located before your script and
    2. it is not marked as async.
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement