2013-05-21 79 views
0

我想顯示一個帶有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

對於節目模式的使用過程中的:http://twitter.github.io/bootstrap/javascript.html#modals

初始化:

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

如果要追加的這一內容DIV動態,只是追加內容到DIV

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

然後顯示模式

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

好吧,我已經將它插入標籤data-id =「prova」,但我怎麼從模態獲得它? – Michele

+0

你想傳入模態的數據是什麼?如果你有模態元素:,並且你想插入一個文本,你應該這樣做: #('#example')。html(「some text」); – Pawel

+0

好的我解決了我的問題。謝謝 – Michele