Opening bootstrap modal with double click

2019-02-25 11:30发布

问题:

I'm trying to open a modal double clicking. I'm using this piece of code but it's not working:

$('#link').dblclick(function () {
  $('#myModal').modal('toggle');
});

Fiddle here: http://jsfiddle.net/labanino/JKEj3/

Thanks!

回答1:

You need to remove data-toggle="modal" from the link..

<a href="#myModal" role="button" class="btn" id="link">Launch modal</a>

http://jsfiddle.net/JKEj3/3/



回答2:

You need to remove data-toggle="modal" from button definition.

http://jsfiddle.net/JKEj3/5/