Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.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
在jQuery中将div从一个位置移动到另一个位置_Jquery - Fatal编程技术网

在jQuery中将div从一个位置移动到另一个位置

在jQuery中将div从一个位置移动到另一个位置,jquery,Jquery,我们有一些我们无法控制的javascript。我需要把它从一个地方移到另一个地方,我想知道这是否可行: ...... <div class='af-row'> <div class='af-header af-mh-123'> here is my info </div> </div> ...... ....... <div class='new-place'><

我们有一些我们无法控制的javascript。我需要把它从一个地方移到另一个地方,我想知道这是否可行:

......

    <div class='af-row'>
      <div class='af-header af-mh-123'>
          here is my info
       </div>
    </div>

......

.......
 <div class='new-place'></div>
但显然不起作用。这可能吗

因此,最终结果是:

 <div class='new-place'>
    <div class='af-row'>
      <div class='af-header af-mh-123'>
          here is my info
       </div>
    </div>
 </div>

这是我的信息
非常简单。

您可以使用

$('.af-mh-123').parent().appendTo(".new-place");

甚至你的解决方案也在起作用。只是没有

见此:


什么是
.af-mh-123
?还有,最终目标是什么?你想移动javascript吗?您的意思是在其他时间执行它吗?为什么不直接执行
$('.new place').append($('.af-mh-123').parent())?我想做的很明显。这些重复的元素是吗?新的地方存在吗?
很明显
并不总是如此,所以我们实际上是从外部加载它-老实说,我认为这超出了jquery。我试过getScript-但我认为你是对的。
$('.af-mh-123').parent().appendTo(".new-place");