繁体   English   中英

link_to与锚标记中的其他html

[英]link_to with additional html within anchor tag

在Rails中使用link_to帮助程序时,如何向链接添加其他内容?

link_to "Stephen Weber", "index.html"

创造了这个:

<a href="index.html">Stephen Weber</a>

但是,如果我想创建它呢?

<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>

我正在玩jQuery Mobile,这就是格式化列表中内容所需要的。

你可以这样做:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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