Passing data to a bootstrap modal

后端 未结 12 1755
心在旅途
心在旅途 2020-11-21 13:10

I\'ve got a couple of hyperlinks that each have an ID attached. When I click on this link, I want to open a modal ( http://twitter.github.com/bootstrap/javascript.html#modal

12条回答
  •  礼貌的吻别
    2020-11-21 14:02

    Bootstrap 4.3 - use code from below snippet - more here

    $('#exampleModal').on('show.bs.modal', function (event) {
      let bookId = $(event.relatedTarget).data('bookid') 
      $(this).find('.modal-body input').val(bookId)
    })
    a.btn.btn-primary.open-AddBookDialog {color: white }
    
    
    
    
    
    
    
    
    
    Open
    
    
    
    

提交回复
热议问题