2012-11-20 33 views
2

我为我的开发目的使用Codeigniter框架和twitter引导程序。在这里我遇到了一个问题,我必须在模态框中编辑表单。如何将数据传递给twitter bootstrap模式框中显示的表单?请帮助我一个可能的解决方案。使用codeigniter在twitter引导模式中填充表单

+0

你想要编辑什么,你想要什么时候编辑它?这是一个JavaScript问题或PHP问题? – Jeemusu

+0

实际上,我想要显示一个表格,它是从twitter引导模式中的表中动态填充的。它的JavaScript问题 – Sree

+2

一些代码开始? –

回答

2
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"> 
</script> 

<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true"> 
    <div class="modal-header"> 
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> 
    <h3 id="myModalLabel">Header of Modal</h3> 
    </div> 
    <div class="modal-body"> 

    <form class="form-element"> 
     Title: <input type="text" class="form-title" value="initial title" /><br /> 
     Something Else: <input type="text" class="form-element2" value="initial value" /><br /> 
     <div class="some-box"> 
      The elements inside the box 
     </div> 
    </form> 

    </div> 
    <div class="modal-footer"> 
    <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Close</button> 
    </div> 
</div> 

<a href="#" class="changeTitle">Click here to change title</a> 
<a href="#" class="changeElement">Click here to change Element2</a> 
<a href="#" class="changeDiv">Click here to change div's contents</a> 

<script> 
$(".changeTitle").click(function(){ 
    $(".form-title").val("New title"); 
}); 
$(".changeElement").click(function(){ 
    $(".form-element2").val("New value of element"); 
}); 
$(".changeDiv").click(function(){ 
    $(".some-box").html("New Contents of the div element"); 
}); 
</script> 
+0

谢谢......我一直在寻找这一个...... :) – Sree