Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

populate modal from table

<script>
$(function(){
    $('#infoModal').modal({
        keyboard: true,
        backdrop: "static",
        show:false,

    }).on('show.bs.modal', function(){
          var getIdFromRow = $(event.target).closest('tr').data('id');
          var name = $(event.target).closest('tr').find('td:eq( 0 )').html();
          var pos = $(event.target).closest('tr').find('td:eq( 1 )').html();
        //make your ajax call populate items or what even you need
        $(this).find('#orderDetails').html($('<b> Order Id selected: ' + getIdFromRow  + '</b>'));
        $(this).find('#name').text(name);
        $(this).find('#pos').text(pos);
    });

});
</script>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #populate #modal #table
ADD COMMENT
Topic
Name
9+3 =