Custom rails confirm box (with $.rails.confirm override)

前端 未结 4 1794
伪装坚强ぢ
伪装坚强ぢ 2021-02-05 15:57

I\'ve been tinkering with this for a long long time.

I would like to hijack the default JS confirm dialog with something I rolled myself. I\'d like to use a completely c

4条回答
  •  野的像风
    2021-02-05 16:28

    I wrote a sample for Rails 3.1 to change the alerts using this solution, but instead of replacing the native alert with the bootstrap one, it does the following:

    • Change the link/button text to 'Sure?' for 2 seconds
    • If the link/button is clicked within 2 seconds, the action is performed
    • Otherwise the link/button flips back to the old text and nothing happens.

    Here is a gist: https://gist.github.com/2594409

    This is following this discussion in the UX forum:

    https://ux.stackexchange.com/questions/20741/action-confirmation-through-double-clicking

提交回复
热议问题