Bootstrap Modal doesn't show

前端 未结 6 1460
不知归路
不知归路 2021-01-18 02:02

I wanted to test out Bootstrap\'s modal element and created a little test page. But nothing shows up and I\'m wondering why, any clues? I got the source from the bootstrap p

6条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-18 02:16

    Your example doesn't have jQuery included.

    Uncaught Error: Bootstrap requires jQuery 
    

    You must include jQuery before including Bootstrap.

    Also, Bootstrap Modal's need to either be toggled by some kind of control on the page, or by JavaScript: http://getbootstrap.com/javascript/#modals-usage

    This means you either need a button with the appropriate data attributes, which would correspond to attributes set on your modal, or execute via javascript

    via JavaScript:

    $('.modal').modal('show')

    Or via attributes on a control:

    EDIT: If you do this, you need to specify the target as the ID of the modal div

    
    

提交回复
热议问题