link_to with additional html within anchor tag
14,196
You Could do:
<%= link_to 'index.html', :title => "Some link" do %>
<h3> Stephen Weber </h3>
...
<% end %>
Related videos on Youtube
Author by
Jeff B
Just another geek with an idea, Mac Book Pro, and a Nikon D200.
Updated on April 09, 2020Comments
-
Jeff B about 4 years
How do I add additional content to a link when using the link_to helper in Rails?
link_to "Stephen Weber", "index.html"
creates this:
<a href="index.html">Stephen Weber</a>
But what if I want to create this?
<a href="index.html"> <h3>Stephen Weber</h3> <p><strong>You've been invited to a meeting at Filament Group in Boston, MA</strong></p> <p>Hey Stephen, if you're available at 10am tomorrow, we've got a meeting with the jQuery team.</p> <p class="ui-li-aside"><strong>6:24</strong>PM</p> </a>
I'm playing around with jQuery Mobile and this is what is required for formatting content in lists.
-
Jeff B about 13 yearsThank you. I feel so stupid. I forgot you could pass in a block. I'll eventually learn this stuff especially with the awesome support of the community!
-
theschmitzer over 12 yearsI had to change "<%= link_to" to "<% link to" to avoid compilation error, FYI.