crowdint / rails3-jquery-autocomplete

An easy and unobtrusive way to use jQuery's autocomplete with Rails 3

Home Page:http://rubygems.org/gems/rails3-jquery-autocomplete

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to initialize autocomplete manually?

jesseclark opened this issue · comments

I have a form element that I want to autocomplete which is displayed in a modal popup as a result of an ajax call.

Obviously the form element isn't around on page load when autocomplete tries to initialize.

I tried executing jQuery('input[data-autocomplete]').railsAutocomplete(); in the on ajax:success function after the element is displayed but was getting Undefined errors in the js console.

Any suggestions for how to make railsAutocomplete work in these circumstances?

Run this call after your modal html.

  .modal
    .body
    ...
  :javascript
    jQuery('input[data-autocomplete]').railsAutocomplete()

@jesseclark are you still facing this issue ?

3 months and we haven't heard back; so I'm closing this out.