How do I get rid of the div that wraps every input in a simple_form?

自古美人都是妖i 提交于 2019-12-03 07:13:27
Viren

Well do something like this pass a params wrapper: false like this

<%= f.input :keywords, 
            label: false,
            wrapper: false,
            input_html: { class: 'span8' }, 
            placeholder: 'Park Slope, Prospect Heights, Fort Green...' %>

And See it would work

Hope this help

So it seems the best way to do this is to use f.input_field.

The docs for Simple_Form don't quite spell it out, but you can view the actual API docs here.

From the docs:

simple_form_for @user do |f|
  f.input_field :name
end

Will Produce:

<input class="string required" id="user_name" maxlength="100"
   name="user[name]" size="100" type="text" value="Carlos" />

use the regular text_field

<%= f.text_field :keywords, :class => "string optional span8", :placeholder => "Park Slope, Prospect Heights, Fort Green..." %>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!