admin管理员组文章数量:1022488
I'm using Simple_form with Rails 3.2.1
All fine, except that I need to set the 'data-content' attribute for the input_html for bootstrap popover
However, when I use the following Rails/Ruby doesn't like the code as there is a dash in the 'data-content' method:
<%= f.input :first_name, :required => true, :label => "First Name", :autofocus => true, :input_html => {:rel => "tooltip", :title => "Testing!", :data-content => "Popover content"}
and i get an error:
undefined local variable or method `content'
Does anyone know how you can set data-content for input elements using simple_form???
thanks
I'm using Simple_form with Rails 3.2.1
All fine, except that I need to set the 'data-content' attribute for the input_html for bootstrap popover
However, when I use the following Rails/Ruby doesn't like the code as there is a dash in the 'data-content' method:
<%= f.input :first_name, :required => true, :label => "First Name", :autofocus => true, :input_html => {:rel => "tooltip", :title => "Testing!", :data-content => "Popover content"}
and i get an error:
undefined local variable or method `content'
Does anyone know how you can set data-content for input elements using simple_form???
thanks
Share Improve this question asked Apr 8, 2012 at 13:25 bobomorenobobomoreno 2,8585 gold badges26 silver badges42 bronze badges3 Answers
Reset to default 4You can't use -
in ruby symbols but you can use a string like "data-content"
. So, this will probably work:
<%= f.input :first_name, :required => true, :label => "First Name", :autofocus => true, :input_html => {:rel => "tooltip", :title => "Testing!", 'data-content'=> "Popover content"}
I think you can use the data setting as follows:
<%= f.input blar..., :input_html => { :data => { content: => "Popover content"}}
this should give you an attribute data-content="Popover content"
You can't use hyphens in your symbol names. :data-content
is interpreted as :data - content
=> the symbol :data
minus `content.
Instead, wrap it in quotes ... "data-content" => "Popover content" ...
I'm using Simple_form with Rails 3.2.1
All fine, except that I need to set the 'data-content' attribute for the input_html for bootstrap popover
However, when I use the following Rails/Ruby doesn't like the code as there is a dash in the 'data-content' method:
<%= f.input :first_name, :required => true, :label => "First Name", :autofocus => true, :input_html => {:rel => "tooltip", :title => "Testing!", :data-content => "Popover content"}
and i get an error:
undefined local variable or method `content'
Does anyone know how you can set data-content for input elements using simple_form???
thanks
I'm using Simple_form with Rails 3.2.1
All fine, except that I need to set the 'data-content' attribute for the input_html for bootstrap popover
However, when I use the following Rails/Ruby doesn't like the code as there is a dash in the 'data-content' method:
<%= f.input :first_name, :required => true, :label => "First Name", :autofocus => true, :input_html => {:rel => "tooltip", :title => "Testing!", :data-content => "Popover content"}
and i get an error:
undefined local variable or method `content'
Does anyone know how you can set data-content for input elements using simple_form???
thanks
Share Improve this question asked Apr 8, 2012 at 13:25 bobomorenobobomoreno 2,8585 gold badges26 silver badges42 bronze badges3 Answers
Reset to default 4You can't use -
in ruby symbols but you can use a string like "data-content"
. So, this will probably work:
<%= f.input :first_name, :required => true, :label => "First Name", :autofocus => true, :input_html => {:rel => "tooltip", :title => "Testing!", 'data-content'=> "Popover content"}
I think you can use the data setting as follows:
<%= f.input blar..., :input_html => { :data => { content: => "Popover content"}}
this should give you an attribute data-content="Popover content"
You can't use hyphens in your symbol names. :data-content
is interpreted as :data - content
=> the symbol :data
minus `content.
Instead, wrap it in quotes ... "data-content" => "Popover content" ...
本文标签: javascriptUsing simpleform to set datacontentStack Overflow
版权声明:本文标题:javascript - Using simple_form to set data-content - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745570813a2156725.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论