


During the development process, we often encounter the situation where a pop-up box displays the table list on the previous page. At this time, there are many ways to solve it. Some people may say to check the data display again, and some people will It is said that you can directly use js to copy the value and then modify it, but now I will introduce how to use jquery to copy the value to the second page and split the copied value.
The master page display data format is as follows:
<p class="materialCode stdtable"> <h2 id="发货情况">发货情况</h2> <ul class="theadUl clearfix"> <li class="td1">发货批次</li> <li class="td2">商品</li> <li class="td3">发货数量</li> <li class="td4">剩余数量</li> <li class="td5">收货数量</li> <li class="td6">收货状态</li> <li class="td7">操作</li> </ul> <table id="table1"> <thead> <tr> <th class="td1"></th> <th class="td2"></th> <th class="td3"></th> <th class="td4"></th> <th class="td5"></th> <th class="td6"></th> <th class="td7"></th> </tr> </thead> <tbody> <c:forEach var="deliverGoodsList" items="${orderDetail.deliverGoodsList}" varStatus="outer"> <c:forEach var="deliverGoodsDetaiList" items="${deliverGoodsList.deliverGoodsDetaiList}" varStatus="inner"> <tr flag="${deliverGoodsList.deliverGoodsId}" orderId="${deliverGoodsList.orderId}" goodsId="${deliverGoodsDetaiList.goodsId}"> <c:if test="${inner.index == 0}"> <td rowspan="${deliverGoodsList.deliverGoodsDetaiList.size()}">${outer.index+1}</td> </c:if> <td> <p class="ord_product"><img src="/static/imghwm/default1.png" data-src="${deliverGoodsDetaiList.goodsImage}" class="lazy" alt="Detailed explanation of copying and splitting table data values in jQuery" > <p> <c:if test="${orderDetail.orderForm.orderType =='2' }"> <h5 id="a-nbsp-href-javascript-void-nbsp-rel-external-nbsp-nofollow-nbsp-deliverGoodsDetaiList-goodsName-a"><a href="javascript:void(0);" rel="external nofollow" >${deliverGoodsDetaiList.goodsName}</a></h5> </c:if> <c:if test="${orderDetail.orderForm.orderType !='2' }"> <h5 id="a-nbsp-href-URL-WWW-shop-index-php-act-goods-goods-id-deliverGoodsDetaiList-goodsId-nbsp-rel-external-nbsp-nofollow-nbsp-deliverGoodsDetaiList-goodsName-a"><a href="${URL_WWW}/shop/index.php?act=goods&goods_id=${deliverGoodsDetaiList.goodsId}" rel="external nofollow" >${deliverGoodsDetaiList.goodsName}</a></h5> </c:if> </p> </p> </td> <td>${deliverGoodsDetaiList.deliveryNum}</td> <td>${deliverGoodsDetaiList.overplusNum}</td> <td>${deliverGoodsDetaiList.takeDeliveryNum}</td> <c:if test="${inner.index == 0}"> <td rowspan="${deliverGoodsList.deliverGoodsDetaiList.size()}"> <c:if test="${deliverGoodsList.deliveryStatus =='10' }"> 待发货 </c:if> <c:if test="${deliverGoodsList.deliveryStatus =='20' }"> 待确认收货 </c:if> <c:if test="${deliverGoodsList.deliveryStatus =='30' }"> 已收货 </c:if> <c:if test="${deliverGoodsList.deliveryStatus =='40' }"> 退货 </c:if> </td> </c:if> <c:if test="${inner.index == 0}"> <td rowspan="${deliverGoodsList.deliverGoodsDetaiList.size()}"><a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="pr beizhu">查看备注 <p class="beizhu_msg beizhu_msg_li" style="display: none;"> <img src="/static/imghwm/default1.png" data-src="${URL_LIB}/static/order/images/sanjiao_orange.png" class="lazy" alt="Detailed explanation of copying and splitting table data values in jQuery" > <p>${deliverGoodsList.logisticsRemark}</p> </p> </a> <c:if test="${deliverGoodsList.deliveryStatus !='30' }"> <input type="button" name="" value="确认收货" class="dayin" onclick="showDeliver(${deliverGoodsList.deliverGoodsId})" > </c:if> </td> </c:if> <%--<td>${deliverGoodsDetaiList.goodsId}</td>--%> </c:forEach> </tr> </c:forEach> </tbody> <c:if test="${empty orderDetail.deliverGoodsList}"> <tbody> <tr class="opt_zanwu"> <td colspan="7">暂无发货信息</td> </tr> </tbody> </c:if> </table> </p> </p>
The following is the pop-up box display page:
<p id="messageBoxWin" class="popup" style="display:none;z-index: 1000; width: 900px; height:500px;left: 50%; position: fixed; top:30%;margin-left:-450px;margin-top:-125px;padding-bottom:20px;"> <p class="title"> <h2 id="确认收货数量">确认收货数量</h2> <p> <a class="min" href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="最小化" style="display:none;"></a> <a class="max" href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="最大化" style="display:none;"></a> <a class="revert" href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="还原" style="display:none;"></a> <a class="close" href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="关闭"></a> </p> </p> <p class="content" style="height:96%;"> <p style="height:70%;overflow: auto;"> <table class="recieveCount"> <thead> <tr> <th class="td1 ">发货批次</th> <th class="td2 ">商品</th> <th class="td3 ">发货数量</th> <th class="td4 ">剩余</th> <th class="td5 ">收货数量</th> </tr> </thead> <tbody> <tr> <td colspan="8" style="color:#FF9400;">请仔细核对收货数量后确认</td> </tr> <%--<input type="button" name="" value="确认" class="ordSure_btn" onclick="comformDeliver(${deliverGoodsList.orderId},${deliverGoodsList.deliverGoodsId})">--%> <%--<input type="button" name="" value="取消" class="ordSure_btn" >--%> </tbody> </table> </p> <p class="bot_btns" style="position: absolute;bottom: 30px;left:0;width:100%;"> <p class="ordSure_btn" style="width:100px; margin-left:30%; float:left; margin-top: 0;" onclick="comformDeliver()">确定</p> <p class="ordCancel_btn" style="width:100px; margin-left:10%; float:left; margin-top: 0;">取消</p> </p> </p> </p> </p>
The following is the jquery code display:
function showDeliver(deliverId){ var delitems= $("#table1 tr[flag='"+deliverId+"']").clone(); $(delitems).each(function(index){ if(index==0){ $($(this).find("td")[6]).remove(); $($(this).find("td")[5]).remove(); var deliverNum = $($(this).find("td")[2]).text(); var inputHTML="<input type='text' onblur='checkAcount(this);' class='sum' value='"+deliverNum+"'>" $($(this).find("td")[4]).empty(); $($(this).find("td")[4]).append(inputHTML); }else{ var deliverNum= $($(this).find("td")[1]).text(); var inputHTML="<input type='text' onblur='checkAcount(this);' class='sum' value='"+deliverNum+"'>" $($(this).find("td")[3]).empty(); $($(this).find("td")[3]).append(inputHTML); } }); $("#messageBoxWin table tbody").empty(); $("#messageBoxWin table tbody").append(delitems); deliverGoodsId=deliverId; }
Have you learned it? Hurry up and try it out. If you find it useful, you can also save it.
Related recommendations;
How to implement deep and shallow copies of arrays and objects
Realizing deep copy and shallow copy in jquery
The difference between JavaScript shallow copy and deep copy
The above is the detailed content of Detailed explanation of copying and splitting table data values in jQuery. For more information, please follow other related articles on the PHP Chinese website!

实现方法:1、用“$("img").delay(毫秒数).fadeOut()”语句,delay()设置延迟秒数;2、用“setTimeout(function(){ $("img").hide(); },毫秒值);”语句,通过定时器来延迟。

区别:1、axios是一个异步请求框架,用于封装底层的XMLHttpRequest,而jquery是一个JavaScript库,只是顺便封装了dom操作;2、axios是基于承诺对象的,可以用承诺对象中的方法,而jquery不基于承诺对象。

修改方法:1、用css()设置新样式,语法“$(元素).css("min-height","新值")”;2、用attr(),通过设置style属性来添加新样式,语法“$(元素).attr("style","min-height:新值")”。

增加元素的方法:1、用append(),语法“$("body").append(新元素)”,可向body内部的末尾处增加元素;2、用prepend(),语法“$("body").prepend(新元素)”,可向body内部的开始处增加元素。

删除方法:1、用empty(),语法“$("div").empty();”,可删除所有子节点和内容;2、用children()和remove(),语法“$("div").children().remove();”,只删除子元素,不删除内容。

在jquery中,apply()方法用于改变this指向,使用另一个对象替换当前对象,是应用某一对象的一个方法,语法为“apply(thisobj,[argarray])”;参数argarray表示的是以数组的形式进行传递。

去掉方法:1、用“$(selector).removeAttr("readonly")”语句删除readonly属性;2、用“$(selector).attr("readonly",false)”将readonly属性的值设置为false。

on()方法有4个参数:1、第一个参数不可省略,规定要从被选元素添加的一个或多个事件或命名空间;2、第二个参数可省略,规定元素的事件处理程序;3、第三个参数可省略,规定传递到函数的额外数据;4、第四个参数可省略,规定当事件发生时运行的函数。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version
