Using jQuery to clone a div:
$(document).ready(function() {
// clicking the buttton
$(".showcanvas").click(function() {
// cloning and appending the div
$(".canvas").first().clone(true).appendTo("article").fadeIn("1200");
});
});
with a p5 canvas inside that div:
<script>
var sketch = function(p) {
p.setup = function(){
p.createCanvas(100, 100);
p.background(0);
}
};
new p5(sketch, 'drawing');
</script>
the div clones correctly but the p5 canvas is not there.
how do I clone the div so that the p5 canvas will be inside it?
https://jsfiddle.net/vanderhurk/xpvt214o/896958/
(click on "show canvas" button to see)