How to bind dynamic data in one bootstrap modal

前端 未结 1 514
天命终不由人
天命终不由人 2021-02-14 11:03

I have one modal in my form

相关标签:
1条回答
  • 2021-02-14 11:17

    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();
    }
    
    0 讨论(0)
提交回复
热议问题