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模態代碼...謝謝你的時間。 –