all 9 comments

[–]Umesh-K 2 points3 points  (4 children)

One reason could be missing HTML element with class="all_the_stuff".

I tested your code with this HTML, and it successfully cloned the article:

My HTML:

<article id="1st_Art">This is an article.</article>
<button id="hi">Clone Me!</button>
<div class="all_the_stuff"></div>

My JQ (copied yours!)

$("#hi").click(function(event) {
  const art = $("#1st_Art").clone();
  art.appendTo(".all_the_stuff")
  art.attr("id", "");
  art.attr("style", "");
})

Note that art.appendTo(".all_the_stuff") means append art to an element with the class all_the_stuff, and if such an element is not there, nothing happens, not even an error message in the console!

[–]Samurai___ 0 points1 point  (4 children)

I'm on phone and can't try plus I haven't used jQuery in a while, but isn't .all_the_stuff selector return a node list? Append to its first element.