jquery - Rails bootstrap delete confirmation with modal -


i want bevore action while clicking on link. should display bootstrap modal cancel , 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 in application.html.erb -> modal empty. set buttons on page load jquery. 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 code modal wait this:

$("#modalbox").on('show.bs.modal', function(e) {   $(this).find('.btn-ok').attr('href', $(e.relatedtarget).data('href')); }); 

whats problem in case?

i've got code example here: http://plnkr.co/edit/nepr0bqf3vmktummhvr7?p=preview

thanks

problem is: modal shown less 100ms ^^ .. , deletion performed

solution 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> 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -