I'm have a bootstrap pop up box using this code.
<a class="btn btn-default" data-toggle="modal" data-target="#addModal"> test</a>
It is working without having any issue. Now I need to do the same(Appear the same pop up) when user double click on a table row which is in the same page. How can I do this?
Try this code:
$('tr').on('dblclick', function() {
$('#addModal').modal('show');
});
Since modal is already initialized by data attibutes on the button (data-target="#addModal"
), you just need to bind dblclick
event and show modal with .modal('show')
method.
Demo: http://plnkr.co/edit/J0SuQdy00dcf9baE7xJu?p=preview
This should work :) listen to double click and after that trigger modal manualy.
$('.table-row').on('dblclick', function(){
$('#addModal').modal('show')
});
Source: http://getbootstrap.com/javascript/#modals
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With