Search This Blog

Saturday 3 November 2012

jQuery: .clone()

The .clone() function is useful to copy a portion of code somewhere in a page.
For example if you have a menu like this:



This is the code where you will see the cloned menu:



And this is the jQuery call to clone the DIV with class .menu in the DIV with class .menubox:

$(".menu").clone().prependTo(".menubox"); 


No comments:

Post a Comment