我點擊了鏈接,顯示引導模式。不過,我需要根據應用的條件顯示模態中的動態內容。如何將動態內容添加到引導模式上點擊鏈接-jquery/JS
JS:
if (success) {
$("#basicModal").modal('show').html("success"); //doesnt work
}else if (error){
$("#basicModal").modal('show').html("error"); //something like this, but doesnt work
}
下面是HTML:
<a class="button-link" data-toggle="modal" data-target="#basicModal">click to test</a>
//bootstrap modal
<div class="modal fade" id="basicModal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
<h3>Modal Body</h3>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
任何想法如何實現這一目標?謝謝!!
$( 「#basicModal .modal體」),空()HTML( 「成功」);例如 – ItayB