Move (Copy) Div From One Place To Another Using jQuery

Posted by bhavin.rana in jQuery



jquery-logo

Hi Friends,Yesterday I needed to move one of my “Inactive” record to “Active” records section when once I click on selectbox and change the record to “Active” status. I can do it by creating new HTML and append it to Active records list. But i came to know about Clone functionality of jQuery, Which is best thing to move or copy any html element.

There are two possibility in Clone function of jQuery. If you want to keep the Div at their place and create the same Div at some other place than you can go for Clone. If you want to Move the Div from one place to another than use appendTo. Look at below syntax.

[jQuery is very useful while you develop any web application. Whatever you can do with jQuery is not enough, you should know much more and implement more and more with jQuery.]

$("div#source_div_id").appendTo("div#destination_div_id");

I hope this post helpful for someone. If you have any question then you can ask me anytime or post it in comment.

Also I am WordPress Developer, Freelance PHP Developer having more than 3 years of experience, So if you want to do any projects then you can contact me.

Hostgator Hosting in 1 Cent Coupon Code – “1CENTHECOUPON” (Without Quotes).

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

  • Abdullah

    Thnkx its very helpful to me thnkx a lot.