简体   繁体   中英

configuring jquery autocomplete with foundation

I configured jquery autocomplete with the rails4-autocomplete gem

Controller

class SuggestionsController < ApplicationController
  autocomplete :school, :name
end

Routes

resources :suggestions do
  get :autocomplete_school_name, :on => :collection
end

View

<div>
  <%= f.label :school %>
  <%= f.autocomplete_field :school, autocomplete_school_name_suggestions_path %>
</div>

The problem is, is that the the view is rendering the autocomplete incorrectly with foundation. Currently, as shown below, the autocomplete suggestions is begin recommending below the label, and above the autocomplete field.

在此处输入图片说明

在此处输入图片说明

看来您缺少jQueryUI CSS,因此请确保在application.css中包含以下内容:

*= require jquery.ui.autocomplete

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM