2

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

4

1 回答 1

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>
于 2012-12-03T17:46:16.993 回答