How can i show data using a modal when clicking a table row (using bootstrap)

前端 未结 3 1419
别跟我提以往
别跟我提以往 2020-12-12 18:58

I\'m sort of a beginner on the whole web development thing and after researching a lot i still couldn\'t get this done. Any help is very much appreciated. I\'m using latest

3条回答
  •  渐次进展
    2020-12-12 19:23

    The solution from PSL will not work in Firefox. FF accepts event only as a formal parameter. So you have to find another way to identify the selected row. My solution is something like this:

    ...
    $('#mySelector')
      .on('show.bs.modal', function(e) {
      var mid;
    
    
      if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) 
        mid = $(e.relatedTarget).data('id');
      else
        mid = $(event.target).closest('tr').data('id');
    
    ...
    

提交回复
热议问题