[英]How to embed javascript confirmation box in Slim href?
我要采取以下行動
a href= url(:event, :destroy, event: allocation.id, company_id: company.id) title="Delete This Event" ==t 'actions.delete'
僅在我在確認框上同意后才能進行。 我想在此href中嵌入javascript代碼:
'javascript:onClick=window.confirm("Are you SURE you want to Delete this Event?")'
我正在使用Slim。 謝謝。
如果您使用啟用了jquery-ujs的rails,就像這樣
= link_to t('actions.delete'), url, confirm: 'Are you SURE you want to Delete this Event?'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.