Preview Saved HTML in Bootstrap Model Dialog


I had to create a Bootstap model Dialog using HTML Content Saved in the Oracle Database LONG column,


Its easy . I will keep the HTML in the a div which is hidden and take the contnet to the model HTML when user prometed.

HTML- Dynamic Table Rows


<div style="display: none" id="preview_<?php echo $row['TB_ID'] ?>" > <?php echo $row['TB_HTML'] ?> </div> 

Model Dialog HTML - End of the Page


<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Detail</h4>
</div>
<div class="modal-body">
<p> </p>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
JS Button Click event to popup the div
$(".btn").on( "click", function() { var id = $(this).attr("data-id"); var mymodal = $('#myModal'); mymodal.find('.modal-body').html($("#preview_"+id).html()); mymodal.modal('show'); }); 

Comments

Popular posts from this blog

ENOENT: no such file or directory, rename : node_modules/async

react-quill Integrate quill-image-resize-module