1

I'm beginner for jquery/coffea script in rails

how do I add option to my coffea script so the generated html will include these options below

autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true"

below is my coffea script that connect with this field

order_details.js.coffee

jQuery ->
    $('.auto_items').autocomplete
      source: $('.auto_items').data('autocomplete-source')

_orderdetails_fields.html.erb

<fieldset>
    <%= f.text_field :item_name, data: {autocomplete_source: item_sources.order(:name).map(&:name)}, class: "auto_items ui-autocomplete-input" %>
    <%= f.hidden_field :_destroy %>
    <%= link_to "remove", '#', class: "remove_fields" %>
</fieldset>

1 Answer 1

1

This is not related to coffeescript I guess, as its regarding html generation.

<%= f.text_field :item_name, data: {autocomplete_source: item_sources.order(:name).map(&:name)}, class: "auto_items ui-autocomplete-input", autocomplete: "off", role: "textbox", 'aria-autocomplete' => "list", 'aria-haspopup' => "true" %>

should generate proper html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.