bootstrap modal does not work

0
<div class="modal fade" id="addhor" role="dialog" >
            <div class="modal-dialog">
                <div class="modal-content">
                        <div class="modal-header">
                            <h4>Adicionar Horário</h4>
                        </div>
                    <div class="modal-body">
                        <p>teste</p>
                    </div>

                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->

I saw this example as modal in the bootstrap, the modal opens but does not work shows the contents with a dark screen and when I click anywhere it closes. Could someone help me?

Q: I have a problem with my keyboard.

    
asked by anonymous 10.11.2014 / 22:52

1 answer

4

For the modal to work there must be an event that in the case of this example was the event of the data-toggle="addhor" button.

<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#addhor">

Launch modal demo

You can also show modal via javascript

$('#addhor').modal('show');

If none of these examples works, the bootstrap javascript file is not inserted in the page.

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>

Formoredetailspleasereadthe Bootstrap Modals documentation.

    
11.11.2014 / 11:55