How to pass a parameter from a link element to a modal window?

后端 未结 3 1414
感情败类
感情败类 2020-12-21 13:54

I have a table. In a cell of the table there is a link like this:

3条回答
  •  悲&欢浪女
    2020-12-21 14:12

    Use the .relatedTarget property mentioned in the Modal Event docs:

    $(document).ready(function () {
        $('#remoteModal').on('show.bs.modal', function (event) {
            console.log($(event.relatedTarget).attr('data-id'));
        });
    });
    

提交回复
热议问题