Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.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,我正在尝试将包含类详细信息的隐藏子div的内容移动到id为section1target的div,但它表示未定义详细信息 我也试过了 $('.profile')。单击(函数(){ $('#section1target').html($(this+'.details').html()); //我也试过。。 $('#section1target').html($(this).next('.details').html()); }); 标题 Lorem ipsum dolor sit amet,

我正在尝试将包含类详细信息的隐藏子div的内容移动到id为section1target的div,但它表示未定义详细信息

我也试过了


$('.profile')。单击(函数(){
$('#section1target').html($(this+'.details').html());
//我也试过。。
$('#section1target').html($(this).next('.details').html());
});
  • 标题 Lorem ipsum dolor sit amet,奉献

    Lorem ipsum dolor sit amet,公元前

  • 标题 同侧阴唇

    Lorem ipsum dolor sit amet


尝试使用
作为选择器上下文,因为您要查找的元素是它的后代

$('#section1target').html($('.details',this).html());
使用:


.next()
仅当元素是下一个兄弟而不是后代时才起作用
$(this)+“.details”
毫无意义,因为
$(this)
是一个jQuery对象,而不是字符串。

它仍然告诉我。细节没有定义。我觉得你的代码中缺少引号。当jQuery找不到选择器时,它不会报告任何错误。我在你的小提琴中没有得到任何错误。它没有做任何事情,因为没有
section1target
DIV,我在中修复了它
$('#section1target').html($('.details',this).html());
$('#section1target').html($(this).find(".details").html());