John Smith
John Smith

Reputation: 6259

Display popover with rails

I try to create a popover with rails and bootstrap like this:

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

But somehow when I render the page is displayed like this (its not encounterd as html):

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

In the inspect mode the html looks like this:

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

What do I wrong? Thanks!

Upvotes: 1

Views: 506

Answers (1)

cristian
cristian

Reputation: 8744

You forgot to add a value for your tag (second argument):

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

Upvotes: 1

Related Questions