php - 使用 codeigniter 在 Twitter Bootstrap 模式中填充表单

标签 php javascript codeigniter twitter-bootstrap modal-dialog

我正在使用 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/

相关文章:

javascript - 如何正确检查输入是否不为零

javascript - jQuery text() 在 toggle() 上发生变化?

javascript - 如何在子 React 组件中调用父方法?

php - CI 错误 :Cannot use object of type CI_DB_mysqli_result as array

php - 如何显示两个特定日期之间的数据,日期格式为时间戳

php - 从mysql数据库中选择希伯来语

php - 嵌套的foreach循环执行?

php - SQL 语法错误代码 1064

php - Laravel 5.1 AJAX - 即使我发送 POST 请求也不允许返回 405 GET 方法

php - 通过引用修改数组