table 增加、删除一行
来源:互联网 发布:java效率最高的排序 编辑:程序博客网 时间:2024/05/21 19:47
前两天项目有个需求是需要在页面中的表格增加一行连签规则的,研究了好一阵,记录下来。 $("table tr:last").after(trHTML); //这里找到
table中的最后一个tr元素 将你需要拼接的内容拼接到后面,trHTML就是你需要拼接的内容
$("table tr").length //获取table下tr的个数
先看下效果图:【这里用到了在table中新增一行、删除一行等等的知识】 附上代码先:
jquery操作:
table中的最后一个tr元素 将你需要拼接的内容拼接到后面,trHTML就是你需要拼接的内容
$("table tr").length //获取table下tr的个数
先看下效果图:【这里用到了在table中新增一行、删除一行等等的知识】 附上代码先:
<div class="mt-50"> <button class="btn btn-primary f-r" id="search" type="button" onclick="addRow()">新增连签积分规则</button> <table class="table table-border table-bordered table-hover table-bg table-sort" id="signTable"> <thead> <tr class="text-c"> <th>奖励类型</th> <th>奖励门槛(天)</th> <th>积分数</th> <th>操作</th> </tr> </thead> <tbody id="tableBody"> <c:forEach items="${conSignRegularList}" var="items"> <tr class="text-c"> <td width="300">连续签到奖励</td> <td> <input type="text" id="continuousSignDay" name="continuousSignDay" class="signDay" value="${items.day}"> </td> <td> <input type="text" id="continuousSignScore" name="continuousSignScore" class="signScore" value="${items.score}"> </td> <td> <button type="button" class="btn btn-danger-outline size-MINI " onclick="deleRow(this)">删除 </button> </td> </tr> </c:forEach> </tbody> </table> </div>
jquery操作:
<div class="mt-50"> <button class="btn btn-primary f-r" id="search" type="button" onclick="addRow()">新增连签积分规则</button> <table class="table table-border table-bordered table-hover table-bg table-sort" id="signTable"> <thead> <tr class="text-c"> <th>奖励类型</th> <th>奖励门槛(天)</th> <th>积分数</th> <th>操作</th> </tr> </thead> <tbody id="tableBody"> <c:forEach items="${conSignRegularList}" var="items"> <tr class="text-c"> <td width="300">连续签到奖励</td> <td> <input type="text" id="continuousSignDay" name="continuousSignDay" class="signDay" value="${items.day}"> </td> <td> <input type="text" id="continuousSignScore" name="continuousSignScore" class="signScore" value="${items.score}"> </td> <td> <button type="button" class="btn btn-danger-outline size-MINI " onclick="deleRow(this)">删除 </button> </td> </tr> </c:forEach> </tbody> </table> </div>
阅读全文
0 0
- table 增加、删除一行
- JS :点击按钮table增加一行,删除一行
- 使用jquery操作table元素:增加或删除一行
- javascript开发系列(table操作,table增加一行,删除一行,取行号,列号)
- EXT增加删除一行
- 增加删除一行
- 支持所有浏览器,通过JS为 Table表增加、删除一行
- 表格动态增加一行和删除一行
- easyui datagrid增加一行或删除一行
- 按钮触发table添加一行删除一行
- JS 删除Table中的一行
- 利用js实现table增加一行
- Table动态增加删除行
- js增加删除table信息
- Table动态增加删除行
- table动态增加删除行数
- JS 动态给表格增加/删除一行
- HTML表格动态增加一行/删除/修改
- JS函数function(event){}在括号内写个event的意思
- 导入工程时android studio报 Migrate Project to Gradle?
- reverse nodes in k-group
- QT TCP通讯无法收到数据的解决方案
- php编写TCP服务端和客户端程序
- table 增加、删除一行
- Keepalived之——安装异常情况
- springboot之404注意项
- hdu 动态规划题集
- java 单例模式
- Tornado开源
- 通过物理机dhcp配置虚拟机网络(wifi上网)
- 55个基础金融名词
- L