我正在使用 Codeigniter 框架和 twitter bootstrap 来实现我的开发目的。这里我遇到了一个问题,我必须在模式框中编辑表单。如何将数据传递到 twitter bootstrap 模式框中显示的表单?请帮我提供一个可能的解决方案。
最佳答案
<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>
关于php - 使用 codeigniter 在 Twitter Bootstrap 模式中填充表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13467251/