Jquery to open Bootstrap v3 modal of remote url

后端 未结 6 1239
孤街浪徒
孤街浪徒 2020-12-01 08:02

I have a page of links to internal pages I need to open up in a Bootstrap modal DIV. The problem is that it seems that using the latest version of Bootstrap v3 in conjunctio

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-01 08:18

    So basically, in jquery what we can do is to load href attribute using the load function. This way we can use the url in tag and load that in modal-body.

    Login
    
    //JS script
    $('.ls-modal').on('click', function(e){
      e.preventDefault();
      $('#myModal').modal('show').find('.modal-body').load($(this).attr('href'));
    });
    

提交回复
热议问题