开发者

Ruby on Rails: How do I add a confirmation to a submit_tag

<%= submit_tag "Delete" , :confirm => 'Are y开发者_运维百科ou sure you want to delete the selected?' %>

doesn't work.

how do I do this?


Try this :

<%= submit_tag "Delete", data: { confirm: 'Are you sure you want to delete the selected?' }%>


It should work. Most likely you didn't include necessary JavaScript files. Do you have something like this in your HTML head tag?

<%= javascript_include_tag :defaults %>


I found this solution and it works to me.

<%= submit_tag 'Save', onclick: "return confirm('Are you sure?')" %>

The Solution link is Here

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜