如何使用js或jquery制作可编辑表?

时间:2017-03-27 06:40:34

标签: javascript php jquery codeigniter

我想创建其内容编辑表,但只有第一行正在编辑。

这不适用于其他行,而不是以任何方式快速回复

<script>
$("#edit_foo").click(function(){
   $("#text1").hide(); 
   $("#text2").hide();
   $("#text3").hide();
   $("#text4").hide();
});
</script>
<div class="table-responsive">
<table class="table table-bordered table-hover">
    <tr>
        <th>Website</th>
        <th>phone</th>
        <th>Email</th>
        <th>Facebook_URL</th>
        <th>Action</th>
    </tr>
                <?php foreach($footertables as $post)
{
?>
    <tr>
        <td><span id="text1"><?php echo $post->website?></span><input type="text" value="<?php echo $post->website?>" class="form-control"/></td>
        <td><span id="text2"><?php echo $post->phone?></span><input type="text" value="<?php echo $post->phone?>" class="form-control"/></td>
        <td><span id="text3"><?php echo $post->Email?></span><input type="text" value="<?php echo $post->Email?>" class="form-control"/></td>
        <td><span id="text4"><?php echo $post->facebook?></span><input type="text" value="<?php echo $post->facebook?>" class="form-control"/></td>
        <td><a href="#" class='btn btn-primary' id="edit_foo"><span>&#x270D;</span>Edit</a> <a href="<?php echo base_url().'dashboard_controller/deletefooter/'.$post->id;?>" class='btn btn-danger delete'><span>&#9003;</span> Delete</a></td>
    </tr>
                <?php
}
?>
    </table>
    </div>

1 个答案:

答案 0 :(得分:0)