Q:

Rails bootstrap delete confirmation with modal

I want to do a bevore action while clicking on a link. It should display a bootstrap modal with cancel and delete button.
code lookslike this:
Delete Button
<button class="btn btn-default" data-href="<%= url_for(:action => :delete, :id => @vid.id) %>" data-toggle="modal" data-target="#modalBox">
            <i class="fa fa-trash"></i> <%= t "movies.add.delete" %>
          </button>

Modal Code is in application.html.erb -> modal is empty. I set the buttons on page load with jquery. that works fine.
    $(".modal-footer").html("<button type='button' class='btn btn-default' data-dismiss='modal'>Cancel</button> <a class='btn btn-danger btn-ok'>Delete</a>");

and the code for the modal to wait is this:
$("#modalBox").on('show.bs.modal', function(e) {
  $(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
});

whats my problem in this case?
I've got the code example from here: 
http://plnkr.co/edit/NePR0BQf3VmKtuMmhVR7?p=preview
thanks
Problem is:
Modal is shown for less than 100ms ^^ .. and the deletion is performed

A:

Solution is to do it this way:
<button class="btn btn-default deletebtn" data-href="<%= url_for(:action => :delete, :id => @vid.id) %>" onclick="check();return false;">
     <i class="fa fa-trash"></i> <%= t "movies.add.delete" %>
</button>

