1

我是 rails 中 jquery/coffea 脚本的初学者

如何向我的咖啡脚本添加选项,以便生成的 html 将在下面包含这些选项

自动完成=“关闭”角色=“文本框”咏叹调自动完成=“列表”咏叹调-haspopup=“真”

下面是我与该领域相关的咖啡脚本

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>
4

1 回答 1

1

我猜这与咖啡脚本无关,因为它与 html 生成有关。

<%= 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" %>

应该生成正确的html

于 2013-06-30T05:19:19.350 回答