Error with jquery-autocomplete in rails
I've been trying to get autoco开发者_JS百科mplete to work, however, I am getting a weird javascript error in the firebug console...
I used the https://github.com/crowdint/rails3-jquery-autocomplete gem.
The error I am getting reads: $(e).autocomplete is not a function
Here are the scripts i am including in my html:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script src="/javascripts/autocomplete-rails.js?1294035084" type="text/javascript"></script>
Thanks
I had this exact problem today and fixed it by installing jQuery UI. Apparently rails3-jquery-autocomplete uses the autocomplete functionality that is included in jQuery UI. It will be broken until you install jquery-rails and include both the jquery UI js and CSS files in your layout.
<%= javascript_include_tag :defaults, "jquery-ui-1.8.9.custom.min", "autocomplete-rails" %>
Quoting the Github site:
Before you start
Make sure your project is using jQuery-ui with the autocomplete widget before you continue.
You can find more info about that here:
http://jquery.com/
http://jqueryui.com/demos/autocomplete/
http://github.com/rails/jquery-ujs
I'd encourage you to understand how to use those 3 amazing tools before attempting to use this gem.
Did you change the default javascript library using this gem?
It's one of the prerequisite of your gem
精彩评论