How to copy a block with the class by clicking on the checked?

There is no way to copy individual element.

Here's an example:

I need to activate the checkbox worked up element with a specific class.

Suppose there are multiple elements with that class:

the <div>
 <p><input class="check" name="name" type="checkbox"></p>
 <p class="copy">1</p>
</div>
the <div>
 <p><input class="check" name="name" type="checkbox"></p>
 <p class="copy">2</p>
</div>
the <div>
 <p><input class="check" name="name" type="checkbox"></p>
 <p class="copy">3</p>
</div>
the <div>
 <p><input class="check" name="name" type="checkbox"></p>
 <p class="copy">4</p>
</div>
...

<div class="modal"></div>


I using (this) to copy each element separately?

Tried so, but then all elements are copied:

$('body').on('change', '.check:checked', function(){
 $(.copy).clone().appendTo( ".modal");
 });
March 19th 20 at 08:23
1 answer
March 19th 20 at 08:25
Solution
$(this).next('.copy').clone().appendTo('.modal')
Your option works fine

This principle is suitable for the recycle bin ?

Let's add product to cart on click - Iva.Hoppe24 commented on March 19th 20 at 08:28
@Iva.Hoppe24, and what's the basket? About the cart nothing in the question there's nothing about her I say. Want to know something about some basket - makes a separate question. - Gilberto.Casp commented on March 19th 20 at 08:31
@Gilberto.Casp, I didn't mean anything about the question of the basket )

I was just wondering about the principle this implementation - Iva.Hoppe24 commented on March 19th 20 at 08:34
@Iva.Hoppe24you do not fully understand where you are. There is not a forum, but your question is not a complication of conversation. The problem stated in the question is settled? Well, never mind. You want to ask something - ask a separate question. - Gilberto.Casp commented on March 19th 20 at 08:37
@Gilberto.Casp, it is not until the end exhausted, so is not working:

https://codepen.io/Iva.Hoppe24/pen/NJoVZj - Iva.Hoppe24 commented on March 19th 20 at 08:40
@Iva.Hoppe24,

$(this).parent().next('.copy').clone().appendTo('.modal')
- Gilberto.Casp commented on March 19th 20 at 08:43
@Gilberto.Casp, thank you )
I have always had problems with these elements, confused all the time - Iva.Hoppe24 commented on March 19th 20 at 08:46

Find more questions by tags jQuery