1
我想在其上添加dinamically一个按钮,点击时显示模式时,模态不工作:引导放置在容器流体
$(document).ready(function(){
$('#rent-php').on('click', '.bike-rent-btn', function(){
$('#confirm-rent-modal').modal('show');
});
});
这是通过PHP dinamically添加的按钮看起来是这样的:
<button type="button" class="btn btn-primary btn-md bike-rent-btn" data-toggle="modal" data-target="#confirm-rent-modal">Rent</button>
这是HTML代码,几乎从复制粘贴W3:
<div class="modal fade modal-sm" id="confirm-rent-modal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body">
<p></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
也有也是容器流体一些自定义的风格:
height: 100vh;
margin: 0;
padding: 30px;
background-color: #EEEEEE;
当这个代码是发生在container-fluid
bootsrap格,没有任何反应。当我把它放在它外面时(标记body
),模态显示,但随后消失。但至少会发生一些事情。
哦,我想这是什么毛病PHP /动态地将触发该事件的按钮。 –
哦,我的上帝,我是一个完全的延迟。我使用'$('#rent-php')。html(result);'而不是'$('#rent-php')。append(result);'overrode模态代码...谢谢你的时间。 –