0

As a beginner with jquery I am trying to figure out autocompletion with autocomplete-jquery in rails for a search form.

currently I have the following code for the search-text-field in my index.html.erb:

<%= text_field_tag :search, params[:search],  class:"form-control", placeholder: "Suchen", data: {autocomplete_source: search_suggestions_path} %>

When I inspect the source-code in my browser I see the following:

enter image description here notice where it says:

autocomplete="off"

in the last line. How can I fix this?

I already tried to include something like

autocomplete: "on"

as an option inside the form, however it does not work.

Thank you very much in advance!

1 Answer 1

0

You can try to add javascript for better management like this

$("#search").autocomplete({
source: '/search_suggestions.json'
});

The search_suggestions_path should return a json with key and value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.