Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

I am unable to make close a second modal in a bootstrap site - what am I doing wrong??

This is the code for the two modals, the behaves perfectly the second modal opens fine but does not close ..

<!-- Button trigger modal --> 
<button class="btn btn-school" data-toggle="modal" data-target="#myModal"> Sample residential programme </button> <!-- Modal -->
<div id="myModal" class="modal fade">
     <div class="modal-dialog">
          <div class="modal-content">
               <div class="modal-header">
               <button class="close" type="button" data-dismiss="modal">×</button>
               <h4 id="myModalLabel" class="modal-title">Sample Residential Programme</h4>
               </div>
              <div class="modal-body">
<table style="height: 262px; width: 550px; border: 1px solid #D3D836;" border="2" cellpadding="2">
<tbody>
<tr>
<td>&nbsp;</td>
<td>
<p><strong>Breakfast</strong></p>
</td>
<td>
<p><strong>AM Session</strong></p>
</td>
<td>
<p><strong>Lunch</strong></p>
</td>
<td>
<p><strong>PM Session</strong></p>
</td>
<td>
<p><strong>Dinner</strong></p>
</td>
<td>
<p><strong>Evening Session</strong></p>
</td>
</tr>
<tr>
<td>
<p><strong>Monday</strong></p>
</td>
<td>
<p>n/a</p>
</td>
<td>
<p>n/a</p>
</td>
<td>
<p>Own</p>
</td>
<td>
<p>ARRIVE, Introductions, Icebreakers,<br />Team Games</p>
</td>
<td>
<p>1815</p>
</td>
<td>
<p>Night Walk</p>
</td>
</tr>
<tr>
<td>
<p><strong>Tuesday</strong></p>
</td>
<td>
<p>0800</p>
</td>
<td>
<p>Archery,&nbsp; Air Rifle Shooting, <br />Laser Clay Shooting</p>
</td>
<td>
<p>Packed</p>
</td>
<td>
<p>Climbing, Abseiling</p>
</td>
<td>
<p>1815</p>
</td>
<td>
<p>Games Evening</p>
</td>
</tr>
<tr>
<td>
<p><strong>Wednesday</strong></p>
</td>
<td>
<p>0800</p>
</td>
<td>
<p>Orienteering</p>
</td>
<td>
<p>Packed</p>
</td>
<td>
<p>Campcraft</p>
</td>
<td>
<p>1815</p>
</td>
<td>
<p>Quiz</p>
</td>
</tr>
<tr>
<td>
<p><strong>Thursday</strong></p>
</td>
<td>
<p>0800</p>
</td>
<td>
<p>Canoeing, Raft Building</p>
</td>
<td>
<p>Packed</p>
</td>
<td>
<p>Kayaking,<br />Powerboating</p>
</td>
<td>
<p>1815 BBQ</p>
</td>
<td>
<p>Murder Mystery</p>
</td>
</tr>
<tr>
<td>
<p><strong>Friday</strong></p>
</td>
<td>
<p>0800</p>
</td>
<td>
<p>Team Challenge - DEPART</p>
</td>
<td>
<p>n/a</p>
</td>
<td>
<p>n/a</p>
</td>
<td>
<p>n/a</p>
</td>
<td>
<p>n/a</p>
</td>
</tr>
</tbody>
</table>
                </div>
                <div class="modal-footer">
                <button class="btn btn-default" type="button" data-dismiss="modal">Close</button>
                </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


<!-- Button trigger modal --> 
<button class="btn btn-school" data-toggle="modal" data-target="#eveningActivities"> Evening Activities </button> <!-- Modal -->
<div id="eveningActivities" class="modal fade">
     <div class="modal-dialog">
          <div class="modal-content">
               <div class="modal-header">
               <button class="close" type="button" data-dismiss="modal">×</button>
               <h4 id="myModalLabel" class="modal-title">Evening Activities</h4>
               </div>
              <div class="modal-body">
<p>We can offer the following range of evening activities:</p>
                </div>
                <div class="modal-footer">
                <button class="btn btn-default" type="button" data-dismiss="modal">Close</button>
                </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

Hi Eliza,

Not all of your html posted correctly.

See this thread for help: https://teamtreehouse.com/forum/posting-code-to-the-forum

2 Answers

Thank you, I have updated my post

Hi Eliza,

I wonder if you have something else going on in your page that would cause a conflict?

I have tested out your html on www.bootply.com and both modals are opening and closing.

Maybe you can put up a demo on bootply where you can try to reproduce the error.