Asked 6 years ago
25 Nov 2017
Views 1349
shabi

shabi posted

how to put iframe in modal box in boostrap ?

how to put iframe in modal box in boostrap ?
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00


script type="text/javascript">
    
    var frameSrc = "www.google.com";
  $('.activity').click(function(){
  var frameSrc = $(this).attr("data");
  
     $('#myModal').on('show', function () {
 
        $('iframe').attr("src",frameSrc);
 
	});
    $('#myModal').modal({show:true})
});
</script>



<a href="javascript:;"  data="www.yahoo.com" class="activity">See Activity</a>
<div class="modal fade" id="myModal" " tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" style="width: 950px;height:400px" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
      
              <iframe src="" width="100%"  height="100%" ></iframe>

       </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>
Post Answer