javascript - jQuery UI autocomplete doesn't work in rails app -


i want use jquery ui autocomplete function in rails app. example in jquery website , want make in rails app. jquery-rails , jquery-ui-rails have been installed.

i added below codes application.js

$(function() {     var availabletags = [       "c",       "c++",       "clojure",       "cobol",       "haskell",       "java",       "javascript",       "perl",       "php",       "python",       "ruby",     ];     $( "#tags" ).autocomplete({       source: availabletags     });   }); 

add codes show.html.erb:

<div class="ui-widget">   <label for="tags">tags: </label>   <input id="tags"> </div> 

but doesn't autocomplete when input something(like: "ja"..)

anyone can me, in advance!

try this:

in gemfile

gem 'rails3-jquery-autocomplete' `bundle install` 

in application.js

//= require autocomplete-rails 

in controller

autocomplete :model_name, :column_name, :full => true 

in routes

resources :controller_name   :autocomplete_model_name_column_name, :on => :collection end 

in view

<%= autocomplete_field_tag 'column_name', '', autocomplete_model_name_column_name_controller_name_path %> 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -