Ruby on Rails:为什么确认消息没有出现在“link_to(‘delete’,...)”中?
我的产品之一旁边有以下链接:
<%= link_to("Delete", {:action => 'destroy', :id => product.id}, :class => 'action', :confirm => 'Are you sure?') %>
但是当我单击它时,确认框不会出现。
生成的 HTML 为:
<a data-confirm="Are you sure ?" class="action" href="/products/destroy/48">Delete</a>
请指教。
I have the following link next to one of my products:
<%= link_to("Delete", {:action => 'destroy', :id => product.id}, :class => 'action', :confirm => 'Are you sure?') %>
but when I click it, the confirmation box does not appear.
The generated HTML is:
<a data-confirm="Are you sure ?" class="action" href="/products/destroy/48">Delete</a>
Please advise.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
检查您的
javascript_include_tag
它应该可以正常工作:)
check your
javascript_include_tag
and it should work fine :)
尝试将其添加为数据属性
try adding it as a data-attribute
确保rails.js 正在页面上加载。实现此目的最简单的方法是:
Ensure rails.js is being loaded on the page. The easiest way to accomplish this is with: