Ed .
Ed .

Reputation: 6403

jQuery Autocomplete (1.8.5) - Uncaught TypeError, property 'source' is not a function

I am attempting to use the jQuery autocomplete widget which I have used previously on earlier versions of jQuery.

With the code I'm currently using (and jQuery UI 1.8.5) I am getting the following error when typing a letter in the initialised autocomplete input field:

jquery-ui-1.8.5.custom.min.js:320Uncaught TypeError: Property 'source' of object #<an Object> is not a function

The autocomplete code is basically the jQuery example documentation (added to my page with other JS on it):

<input type="text" id="example" />
<script type="text/javascript">
    var data = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities".split(" ");
    $("#example").autocomplete(data);
</script>

Anyone have any suggestions?

Thanks in advance.

Upvotes: 10

Views: 8672

Answers (2)

Vebjorn Ljosa
Vebjorn Ljosa

Reputation: 18008

It looks like you are trying to call the autocomplete widget in jQuery UI the same way that the deprecated autocomplete jQuery plugin was called. The entire API is different, so take a look at the migration guide, but your example would be

$("#example").autocomplete({ source: data });

Upvotes: 2

Lazarus
Lazarus

Reputation: 43084

I think that should be:

$("#example").autocomplete({ source: data });

Upvotes: 17

Related Questions