Bootstrap popup when double clicking a table row

I have a popup for download using this code.

<a class="btn btn-default" data-toggle="modal" data-target="#addModal"> test</a>

It works without any problems. Now I need to do the same (a pop-up window will also appear) when the user double-clicks on a row of a table that is on the same page. How can i do this?

+4
source share
3 answers

Try this code:

$('tr').on('dblclick', function() {
    $('#addModal').modal('show');
});

Since the modal is already initialized with the data settings on the ( data-target="#addModal") button , you just need to bind the event dblclickand show the modal value with .modal('show').

: http://plnkr.co/edit/J0SuQdy00dcf9baE7xJu?p=preview

+4

"show" bootstrap modal .

- -

$('tr').dblclick(function(){
$('#addModal').modal('show');
})
+2

This should work :) listen to the double-click and then launch the modal manual.

 $('.table-row').on('dblclick', function(){
       $('#addModal').modal('show')
    });

Source: http://getbootstrap.com/javascript/#modals

+1
source

All Articles