简体   繁体   English

使用目标:button_tag上的“ _blank”

[英]Using target: “_blank” on button_tag

I have a button_tag in a modal. 我在模态中有一个button_tag。 I want the button to open the link in a new window. 我希望按钮在新窗口中打开链接。 I have tried using target: "_blank" but it doesn't work. 我尝试使用目标:“ _ blank”,但它不起作用。 I have tried using a link_to as well, but that doesn't even open the modal. 我也尝试过使用link_to,但这甚至没有打开模式。

Here's my code in the view: 这是视图中的代码:

= button_tag(type: 'submit', class: "btn btn-lg btn-test") do
  Go <i class='icon-external-link'></i>

Please help! 请帮忙! Thanks. 谢谢。

要将表单提交到新窗口,请在<form>元素上使用target属性:

<form action="" target="_blank">

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

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