Tim Sullivan
Tim Sullivan

Reputation: 16888

jQuery UI AutoComplete - not a function

I'm getting this error, and can't figure out why.

TypeError: Result of expression '$('#schedule_person_person_name').autocomplete' [undefined] is not a function.

Here's the relevant code from my HTML:

<script src="/javascripts/libs/jquery-1.4.2.js" type="text/javascript"></script>
<script src="/javascripts/jquery-ui.min.js" type="text/javascript"></script>
<script src="http://cdn.jquerytools.org/1.2.5/jquery.tools.min.js" type="text/javascript"></script>

<script>
  $(document).ready(function() {
    $('#schedule_person_person_name').autocomplete({
    minLength: 2,
        source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
    });
  });
</script>

I'm fairly confident that jQuery UI is being loaded, as when I inspect it in Safari I can browse the code on the Resources tab.

If I change the line of code to:

$('#schedule_person_person_name').css('background-color', 'red');

... the background turns red, so I know the selector is working.

I'm about ready to punch my screen, because nothing seems wrong, so I'm starting to wonder if my brain is just not seeing it correctly anymore. Stupid brain.

Upvotes: 2

Views: 5360

Answers (2)

Tim Sullivan
Tim Sullivan

Reputation: 16888

It appears to be some kind of conflict with jQuery Tools. I've done a custom build that includes just what I wanted (the tooltips), and that resolved the problem. Weird.

Upvotes: 3

Abdul Kader
Abdul Kader

Reputation: 5842

Your code doesn't seems to have the autocomplte.js . Add this into your script or download it to your static diretly

  <script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js"></script>

Upvotes: 0

Related Questions