Yii2 Modal Dialog on Gridview view and update button shows same content for both buttons

半世苍凉 提交于 2019-11-29 08:13:46

This happens because of this line:

$('.modal-body').html(data);

That means the html will be inserted into each modal body.

In case of multiple modals in one page you should specify exact modal which you want to change.

Change this line to:

$('#activity-modal').find('.modal-body').html(data);

Additionally you can clear modal's content using events:

$('#activity-modal').on('hidden.bs.modal', function (e) {
    $(this).find('.modal-body').html('');
})

Check the events section in official Boostrap 3 documentation to modals.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!