gpt4 book ai didi

ruby-on-rails - 如何在 link_to 远程中包含类?

转载 作者:行者123 更新时间:2023-12-04 06:17:48 26 4
gpt4 key购买 nike

我有这段代码,我想包含字形图标,但下面的代码不起作用。如果我删除 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 %>

最佳答案

尝试将其更改为:

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

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

关于ruby-on-rails - 如何在 link_to 远程中包含类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29733907/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com