twitter bootstrap模式只与js一起使用

时间:2014-05-19 09:56:11

标签: javascript php jquery codeigniter twitter-bootstrap

使用Codeigniter在PHP中实现,我正在为我的项目使用Twitter Bootstrap Modal。目标是当我单击模态时,将出现名称的输入表单。幸运的是,模态获取了我需要的数据(即社区的名称)。但是,当我逐个加载模态时,我的代码here只能在第一个模态中运行:

以下是我的视图页面中的代码以及上面链接的代码:

//..code here

<?php foreach ($name_list as $list) { ?>

模态触发器

<img class="pointer" title="Edit" src="pic.png" data-toggle="modal" data-target="<?php echo "#" . $list->name?>"/> <?php echo $list->name?>

模态

<div class="modal fade bs-example-modal-sm" id="<?php echo $list->name ?>" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">Edit <?php echo $list->name?></h4>
            </div>

            <form action="<?php echo base_url();?>edit" method="post">
                <div class="modal-body">
                    <b><p id="warning"></p></b>
                    <input name="edit-name" id="edit-name" type="text" placeholder="Name" value="<?php echo $list->name?>"/>
                    <input name="edit-id" type="text" value="<?php echo $list->id?>" class="hidden"/>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <input type="submit" id="edit-btn" disabled="true" class="btn btn-primary" value="Save changes" />
                </div>
            </form>

        </div>
    </div>
</div>

我的代码出了什么问题?为什么我的JS代码只能运行一次?

0 个答案:

没有答案
相关问题