在两个表之间来回移动表行

编程入门 行业动态 更新时间:2024-10-11 03:26:24
本文介绍了在两个表之间来回移动表行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

更多推荐

在两个表之间来回移动表行

本文发布于:2023-11-22 01:22:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1615419.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:来回   两个

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!