<input id="btntext" type="button" value="添加文本组件" data-toggle="modal" data-target="#myModal01" href="../SysManage/ZuJianManage.aspx"/> <!-- Modal --> <div class="modal hide fade" id="myModal01" tabindex="-1" role="dialog"> <div class="modal-header"><button class="close" type="button" data-dismiss="modal">×</button> <h3 id="myModalLabel">Modal header</h3> </div> <div class="modal-body"></div> </div>
Note: data-target attribute, pointing to the id model, so click the button, model will pop up.
js controlled, the following code:
Display: $ ( '# myModal01') modal ( 'show');.
Hide: $ ( '# myModal01') modal ( 'hide');.
switch: $ ( '# myModal01') .modal ( 'toogle');
event: $ ( '# myModal01') on ( 'hidden', function () {// do something ...});.
js controlled, the following code:
Display: $ ( '# myModal01') modal ( 'show');.
Hide: $ ( '# myModal01') modal ( 'hide');.
switch: $ ( '# myModal01') .modal ( 'toogle');
event: $ ( '# myModal01') on ( 'hidden', function () {// do something ...});.
If you do not need modal animation effects (fade effect) when the box pops up, delete
.fade
class can.
Reference:
https://v3.bootcss.com/javascript/#js-overview