我可以把一个已经存在的分区到另一个已经存在的分区? [英] Can i append an already existing div to another already existing div?

查看:112
本文介绍了我可以把一个已经存在的分区到另一个已经存在的分区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在它自己的一个div不透明0一个接触的形式,并在内容取决于什么菜单,在用户点击动态操纵一个div。
用户获取到我需要明确显示所有内容,然后在div的内容菜单的最后阶段后,动的形式DIV进去,
会是这样的工作?

I have a contact form in a div on it's own with opacity 0, and a div where content is dynamically manipulated depending on what the user click on the menu. After the user gets to the last stage of the menu i need to clear the content of the div that displays everything and then "move" the form div into it, would something like this work?

$('#menu_form').on('click', function() {
    $('#form_div').append('#display_div');
});

因此​​,要回顾一下2现有的div,需要将其中的一个到另一个上点击。

So to recap 2 already existing divs, need to place one of them into the other on click.

推荐答案

您可以使用: .appendTo()方法:

$('#menu_form').on('click', function(){
   $('#form_div').appendTo('#display_div');  // appendTo -> selector
});

也可以使用 .append()方法:

$('#menu_form').on('click', function(){
   $('#display_div').append( $('#form_div') ); // append -> object
});

这篇关于我可以把一个已经存在的分区到另一个已经存在的分区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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