简体   繁体   中英

How to embed javascript confirmation box in Slim href?

I want the following action

a href= url(:event, :destroy, event: allocation.id, company_id: company.id) title="Delete This Event" ==t 'actions.delete'

to be done only after I agree to it on a confirmation box. I want to embed in this href the javascript code:

'javascript:onClick=window.confirm("Are you SURE you want to Delete this Event?")'

I am using Slim. Thanks.

如果您使用启用了jquery-ujs的rails,就像这样

= link_to t('actions.delete'), url, confirm: 'Are you SURE you want to Delete this Event?'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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