How to add data to current block?

0 like 0 dislike
3 views
Hello! Friends, please tell me!

There are several dynamically created blocks class test:
AddAddAdd


When you click on Add, I would like to create the desired block in the current block div.test and click on Add.
$(document).on("click", ".create-block", function () { $('.test').append('NEW BLOCK!'); });


Trying to do, but I get that blocks are created in all blocks div.test, and it is clear, as the processor so configured. But the question is how to fix that content was added in the current block, where he was click on Add?

Thank you very much for the help!
by | 3 views

1 Answer

0 like 0 dislike
Replace
$('.test').append('NEW BLOCK!');
on
$(this).closest('.test').append('NEW BLOCK!');
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
asked May 22, 2019 by Nikolino
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
asked Jun 2, 2019 by xakslim
110,608 questions
257,186 answers
0 comments
33,901 users