How to bind dynamic data in one bootstrap modal

旧街凉风 提交于 2019-12-03 14:08:49
hamed

You can pass a dynamic variable to a function and then in the function you can use that variable to 'manually' open the modal:

<button class="btn btn-primary tag_cnt" style="top:144px; left:510px" onclick="showModal('data')" type="button" value="1"></button>

In your javascript you can access that like this:

function showModal(data)
{
   //you can do anything with data, or pass more data to this function. i set this data to modal header for example
   $("#myModal .modal-title").html(data)
   $("#myModal").modal();
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!