I want to clone a element with id abc
to abc1,abc2,abc3
etc when I click the element with abc
id.
Here is the code I am trying which isn't working :(
<html><body>
<p onclick="aa()" id="abc">HEEYYEYEY</p>
<p id="xx"></p>
</body>
<script>
var temp=0;
function aa(){
temp=temp+1;
document.getElementById("xx").innerHTML=temp;
$('#abc').clone().appendTo('#abc'+temp);
}
</script>
</html>
Please help. What am I doing wrong?
And is there any way so that I can place these cloned elements to somewhere specific I want (say below some image or after a paragraph with id pr
)
Thanks in advance.
NOTE: question updated (class="abc has been changed to id="abc")(still not working)