Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/451.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将此javascript函数转换为jquery_Javascript_Jquery - Fatal编程技术网

将此javascript函数转换为jquery

将此javascript函数转换为jquery,javascript,jquery,Javascript,Jquery,有人能将这个普通javascript函数转换为使用jquery函数吗?谢谢 move_object = function (from, to) { var i, // local variable childnodes_length; // number of child nodes // test if "from" cell is equal to "to" cell then do nothing if (from === to) { re

有人能将这个普通javascript函数转换为使用jquery函数吗?谢谢

move_object = function (from, to) {
    var i, // local variable
    childnodes_length; // number of child nodes 
    // test if "from" cell is equal to "to" cell then do nothing
    if (from === to) {
        return;
    }
    // define childnodes length before loop (not 
    // in loop because NodeList objects in the DOM are live)
    childnodes_length = from.childNodes.length;
    // loop through all child nodes
    for (i = 0; i < childnodes_length; i++) {
        // '0', not 'i' because NodeList objects in the DOM are live
        to.appendChild(from.childNodes[0]); 
    }
};
move_object=函数(从,到){
var i,//局部变量
childnodes_length;//子节点数
//测试“from”单元格是否等于“to”单元格,然后不执行任何操作
如果(从===到){
返回;
}
//定义循环前的子节点长度(非
//在循环中,因为DOM中的节点列表对象是活动的)
childnodes_length=from.childnodes.length;
//循环遍历所有子节点
对于(i=0;i
这应该可以做到:

$(from).contents().appendTo(to);
现场演示:

这应该可以做到:

$(from).contents().appendTo(to);

现场演示:

当然可以。您还想让我们做些什么吗?能否发布您的JQuery代码版本,让我们知道您在哪里找到了它?这个函数的作用是什么?你试过jquery吗?试试这些当然。您还想让我们做些什么吗?能否发布您的JQuery代码版本,让我们知道您在哪里找到了它?这个函数的作用是什么?你试过jquery吗?试试这些