有没有更好的方法来执行此链接

发布于 2024-12-26 06:00:38 字数 346 浏览 4 评论 0原文

这是我的 link_to

  <%= link_to "<input type='button', value='Somewhere', class ='big'/>".html_safe, selection_path %>

但在 IE 中不起作用...它的渲染

  <a href="/selection"><input class="big" value="Somewhere" type="button" ,=""></a>

因此链接中存在损坏....有关如何修复的任何想法

Here is my link_to

  <%= link_to "<input type='button', value='Somewhere', class ='big'/>".html_safe, selection_path %>

but in IE is not working ...its rendering

  <a href="/selection"><input class="big" value="Somewhere" type="button" ,=""></a>

so there is a breakage in the link ....any ideas on how to fix

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

卸妝后依然美 2025-01-02 06:00:38

使用 button_to 而不是将按钮放在链接到:

<%= button_to "Somewhere", selection_path, :method => :get %>

Use button_to instead of putting a button inside of a link_to:

<%= button_to "Somewhere", selection_path, :method => :get %>
阪姬 2025-01-02 06:00:38
  1. 属性之间不应有逗号。
  2. link_to 用于链接,button_to 用于按钮。最好不要尝试将两者混合在一起。这里,您在 link_to 帮助器内部有一个 button 类型的 input。各种混乱不断发生。我想这可能会起作用,但这似乎是一种困难的方法。尝试使用 button_to 代替
  1. Shouldn't have commas between properties.
  2. link_to is for links, button_to is for buttons. It's probably best to not try to mix the two. Here you've got an input of type button inside of a link_to helper. All kinds of confusion going on. I suppose it might work, but it seems like the hard way of doing it. Trying using a button_to instead
泪之魂 2025-01-02 06:00:38

您不应该在属性之间放置逗号。

<%= link_to "<input type='button' value='Somewhere' class='big'/>".html_safe, selection_path %>

You're not supposed to put commas between properties.

<%= link_to "<input type='button' value='Somewhere' class='big'/>".html_safe, selection_path %>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文