twitter-bootstrap 如何在模态弹出引导程序中动态显示信息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16671537/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to display information dynamically in modal popup bootstrap
提问by Michele
I would like to display a modal popup with bootstrap.This modal should display information which should be placed dynamically. What I want is to display a name in nome articoloecc ecc .Here is what I've done so far.
我想显示一个模态弹出窗口bootstrap。这个模态应该显示应该动态放置的信息。我想要的是在nome articoloecc ecc 中显示一个名称。这是我到目前为止所做的。
<span class="btn-group">
<a href="#responsive" role="button" class="btn btn-small" data-toggle="modal" data-id="prova"><i class="icon-pencil"></i></a>
</span>
<!-- Modal Definitions (tabbed over for <pre>) -->
<div id="responsive" class="modal hide fade" tabindex="-1" data-width="760">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Inserisci Articolo</h3>
</div>
<div class="modal-body">
<div class="row-fluid">
<div class="span12">
<p>Codice Barre <input type="text" class="span12" name="codiceBarre" id="codiceBarre" /></p>
<p>Nome Articolo <input type="text" class="span12" /></p>
<p>Quantità <input type="text" class="span12" /></p>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn">Chiudi</button>
<button type="button" class="btn btn-primary">Salva</button>
</div>
</div>
回答by Pawel
For show modal use of course: http://twitter.github.io/bootstrap/javascript.html#modals
对于显示模式当然使用:http: //twitter.github.io/bootstrap/javascript.html#modals
Init:
在里面:
$('#responsive').modal(options)
If you want to append content of this div dynamically, just append content into div
如果你想动态追加这个 div 的内容,只需将内容追加到 div 中
$('#responsive').append(content) or $('#responsive').html( content )
Then display modal
然后显示模态
$('#responsive').modal('show')

