Bootstrap Modal Body Content Not Hiding
You have to move your code for the modal outside of the table. I typically put modal code at the very bottom of the page before the </body> tag.
See working fiddle: http://jsfiddle.net/mty3g/19/
<body>
<div class="container">
<table class="table table-width-condensed spacer-top">
<tr>
<td><a href="#fee-details" data-toggle="modal">$800</a></td>
<td><a href="#company-about" data-toggle="modal">Company Name</a></td>
</tr>
</table>
</div> <!-- /container -->
<!-- Modal -->
<div class="modal fade" id="company-about" tabindex="-1" role="dialog" aria-labelledby="company-about-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="company-about-label">Company Name</h4>
</div>
<div class="modal-body">
<p>Company summary...</p>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal -->
<div class="modal fade" id="fee-details" tabindex="-1" role="dialog" aria-labelledby="fee-details-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="fee-details-label">Fee Details</h4>
</div>
<div class="modal-body">
<table class="table table-condensed">
<thead>
<tr>
<th>Header1</th>
<th>Header2</th>
</tr>
</thead>
<tbody>
<tr>
<td>data1</td>
<td>data2</td>
</tr>
</tbody>
</table>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="js/bootstrap.js"></script>
</body>
TimNguyenBSM
The power you have have at your fingertips can and will change the world, the question is what world do you want to see? Imagine a portfolio of companies generating hundred of billions in profits annually, wherein 100% of profits are "reinvested" to solve the worlds largest social issues. Your money then, is a vote as to what you want to see in the world. Together, all our purchases are a direct link to the future we want to see... ...that's what we're trying to accomplish everyday at BeSmartee. BeSmartee is a dream and will take multiple generations to reach, so it's imperative we start today. One of my favorite quotes is an old Chinese Proverb, “The best time to plant a tree is twenty years ago. The second best time is now.” If you believe in the BeSmartee world, I would love to hear from you. You can learn more about me at my LinkedIn Profile.
Updated on June 04, 2022Comments
-
TimNguyenBSM almost 2 years
This Modal works perfectly:
<!-- Modal --> <div class="modal fade" id="company-about" tabindex="-1" role="dialog" aria-labelledby="company-about-label" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="company-about-label">Company Name</h4> </div> <div class="modal-body"> <p>Company bio here...</p> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal -->
This Modal below follows the above Modal immediately, but the Table is showing, rather than being hidden. On click, the Table content is blank. If I delete the Table data and replace with a text, it works as expected:
<!-- Modal --> <div class="modal fade" id="fee-details" tabindex="-1" role="dialog" aria-labelledby="fee-details-label" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="fee-details-label">Fees - What this loan will cost you to close</h4> </div> <div class="modal-body"> <table class="table table-condensed"> <thead> <tr> <th>Header1</th> <th>Header2</th> <th>Header3</th> </tr> </thead> <tbody> <tr> <td>data1</td> <td>data2</td> <td>data3</td> </tr> </tbody> </table> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal -->