如何在模态弹出引导程序中动态显示信息

时间:2013-05-21 13:40:26

标签: jquery twitter-bootstrap modal-dialog

我想显示一个带有bootstrap的模态弹出窗口。这个模态应该显示应该动态放置的信息。我想要的是在 nome articolo ecc 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">&times;</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&agrave;  <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>

1 个答案:

答案 0 :(得分:1)

对于show modal当然使用:http://twitter.github.io/bootstrap/javascript.html#modals

初​​始化:

$('#responsive').modal(options)

如果您想动态附加此div的内容,只需将内容附加到div

即可
$('#responsive').append(content) or $('#responsive').html( content )

然后显示模态

$('#responsive').modal('show')