在两个表之间来回移动表行 [英] Moving table row back and forth between 2 tables

查看:78
本文介绍了在两个表之间来回移动表行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面的代码允许我通过点击行值将值从随机水果表移动到绿色水果表。并且代码也能够将我从随机水果表移回的值移回绿色水果表。问题是代码只能执行这个过程一次,但我希望它能够无限次地执行过程有任何简单的方法来实现这一点任何帮助将不胜感激,谢谢!



我尝试过:



这是我的JSFiddle [ ^ ]

I have this code below that allows me to move values from the Random Fruits Table to the Green Fruits Table by click on the row value. And the code is also able to move back the value i moved from Random Fruits Table back to the Green Fruits Table. The problem is that the code is only able to only execute this process once but i want it to be able to execute the process unlimited times is there any simple way to accomplish this any help would be greatly appreciated thanks!

What I have tried:

Here is my JSFiddle[^]

推荐答案

您好,



点击随机水果表中的行,您将向Green Fruit表添加新内容,但您的Jquery仅针对创建的元素侦听事件在页面加载时。所以你要稍微改变你的脚本



Hi,

On click of row in Random Fruit table, you are appending new to Green Fruit table but your Jquery listens to event only for element which where created at time of page load. So you to change your script slightly to

function listener(obj) {


document )。ready( function () {
(document).ready(function() {


document )。on( 单击 #fruityid td function (){
...其余代码在这里
});
});
(document).on("click","#fruityid td",function() { ... Rest of code goes here }); });





使用



By using


这篇关于在两个表之间来回移动表行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆