【问题标题】:Display popover with rails显示带有导轨的弹出框
【发布时间】:2015-03-24 21:00:46
【问题描述】:

我尝试使用 rails 和 bootstrap 创建一个弹出框,如下所示:

        <%= content_tag(:a, role: "button", data: {
                        content: "#{image_tag('/user.png')}",
                        toggle: "popover",
                        content: "Click here"
            }) %>

但不知何故,当我渲染页面时,显示如下(它不是作为 html 遇到的):

{:data=>{:content=>"Click here", :toggle=>"popover"}}

在检查模式下,html 如下所示:

<a>{:data=&gt;{:content=&gt;"Click here", :toggle=&gt;"popover"}}</a>

我做错了什么?谢谢!

【问题讨论】:

  • 您忘记为标签&lt;%= content_tag(:a, 'your button', role: "button", data: { content: "#{image_tag('/user.png')}", toggle: "popover", content: "Click here" }) %&gt;添加值
  • @cristian 非常感谢!请把它写成答案!这样我就可以评价它了!

标签: html ruby-on-rails twitter-bootstrap popover


【解决方案1】:

您忘记为标签添加值(第二个参数):

<%= content_tag(:a, 'your button', role: "button", data: { content: "#{image_tag('/user.png')}", toggle: "popover", content: "Click here" }) %>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-26
    • 2020-06-24
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多