开发者

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_p开发者_开发百科erson_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.


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.


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜