简体   繁体   中英

link_to with additional html within anchor tag

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.

You Could do:

 <%= link_to 'index.html', :title => "Some link" do %>
     <h3> Stephen Weber </h3>
     ...
 <% end %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM