简体   繁体   English

在表格中添加或删除单个列

[英]Add or remove individual column in table

I am currently writing a script where the user needs to add data to a table, but he can use an add button to add another column and this needs to be done on each individual row. 我目前正在编写一个脚本,用户需要将数据添加到表中,但是他可以使用添加按钮添加另一列,这需要在每一行上完成。 Also, I would need a remove button which comes up next to each information as you mouse over each bit of information. 此外,当您将鼠标悬停在每一位信息上时,我需要一个删除按钮,该按钮会出现在每个信息旁边。

At the minute I have a static table where it has two columns on each row like this... 那时我有一个静态表,每行有两列,如下所示......

<table>
    <tr>
        <td>Row1 Column1</td>
        <td><input type="text" name="val2">Row2 Column1</input>//Remove btn on mouseover</td>
    </tr>//Add btn
    <tr>
        <td>Row1 Column2</td>
        <td><input type="text" name="val2">Row2 Column2</input>//Remove btn on mouseover</td>//Add btn
    </tr>
</table>

What would I need to dynamically add and/or remove each item, Javascript or jQuery? 我需要动态添加和/或删除每个项目,Javascript或jQuery?

Do you know any tutorials which could help with this? 你知道任何有助于此的教程吗?

My Javascript and jQuery knowledge is pretty much void since I haven't looked at it in over a year. 我的Javascript和jQuery知识几乎无效,因为我在一年多的时间里没有看过它。

http://www.mredkj.com/tutorials/tableaddcolumn.html http://www.mredkj.com/tutorials/tableaddcolumn.html

Then use jquery to post the info to your server and a php handler to handle the info and save it. 然后使用jquery将信息发布到您的服务器和一个PHP处理程序来处理信息并保存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM