I've a delete button generated by the link_to
helper method. It produces the following markup.
<a href="/clips/150" class="btn btn-mini btn-danger" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Destroy</a>
When, I click this button, it opens confirm
dialog box as expected.
However, I want to override this confirm dialog box. I want to show a confirm dialog box using Bootbox.
So, I tried to unbind the click events from these buttons. I've tried all the following ways (in console). But none works.
$('a[data-confirm]').unbind('click')
or,
$('a[data-confirm]').off('click')
or,
$('a[data-confirm]').undelegate('click')
Even, I tried click.rails
as event name as I see this is the declaration in jquery_ujs.js.
$(document).delegate(rails.linkClickSelector, 'click.rails', function(e) {
You may ask me to remove :confirm => true
when calling helper method. But I don't want that. I want that as default feature. I will override runtime. How can I achieve that?