populate modal from table

Solutions on MaxInterview for populate modal from table by the best coders in the world

showing results for - "populate modal from table"
Clara
19 Sep 2020
1<script>
2$(function(){
3    $('#infoModal').modal({
4        keyboard: true,
5        backdrop: "static",
6        show:false,
7
8    }).on('show.bs.modal', function(){
9          var getIdFromRow = $(event.target).closest('tr').data('id');
10          var name = $(event.target).closest('tr').find('td:eq( 0 )').html();
11          var pos = $(event.target).closest('tr').find('td:eq( 1 )').html();
12        //make your ajax call populate items or what even you need
13        $(this).find('#orderDetails').html($('<b> Order Id selected: ' + getIdFromRow  + '</b>'));
14        $(this).find('#name').text(name);
15        $(this).find('#pos').text(pos);
16    });
17
18});
19</script>