I have a handful of different modal dialogs that contain different content. Basically, click button1 displays modaldialog1...click button2 displays modaldialog2, etc, etc.
How can I reuse that html code within JavaScript or some other reusable container and pass in data to one reusable modal?
Essential Code for button1 click and supporting code for modalDialog1:
Button Code (for click to display modal)
<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a>
HTML for displaying the modal...How can I reuse this code say within a JavaScript function or some other way and pass in some variables for Modal Header and classIDThatContainstheContentsforModal so that the modal can be reusable?
Not sure if this could go into a JavaScript or some other methodology.
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal Header</h3>
</div>
<div class="modal-body">
<div id="container" class="classIDThatContainstheContentsforModal">
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>