如何在link_to remote中包含类?

3

我有这段代码,想要添加 glyphicon,但下面的代码无法生效。如果我移除 subcomment_link 类,它会起作用,但我真的需要为 jquery 包含它。有关远程和指定类的 link_to 的正确语法是什么?

<%= link_to new_subcomment_path(:response_id => response.id), class: "subcomment_link", id: "reply_new_subcomment#{response.id}", remote: true do %> 
    <i class="glyphicon glyphicon-pencil"></i>&nbsp Edit your profile 
<% end %>

1
下面的代码无法工作 - 更多细节,请?如果没有异常,渲染的HTML是什么样子? - BroiSatse
1个回答

2

尝试将其更改为:

<%= link_to new_subcomment_path(:response_id => response.id), {remote: true}, {class: "subcomment_link", id: "reply_new_subcomment#{response.id}"} do %>

通常标签选项出现在HTML选项之前。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接