I have many blocks with class row. Each block contains two elements (name and price).
I need to pull all the values from the blocks with the active-row class and add all the values to the block with the all-text class.
The problem is that only one value is taken from me, but they have to - everything.
Here is my sample code:
$.each($('.active-row'), function() { var uslugi = $(this).find('.name').text() + $(this).find('.price').text(); $('.all-text').text(uslugi); }); .all-text { margin-top: 50px; color: red; } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <div class="row"> <div class="name"> Машина </div> <div class="price"> 1250 </div> </div> <div class="row active-row"> <div class="name"> Коляска </div> <div class="price"> 1250 </div> </div> <div class="row active-row"> <div class="name"> Велосипед </div> <div class="price"> 1250 </div> </div> <div class="row active-row"> <div class="name"> Машина </div> <div class="price"> 1250 </div> </div> <div class="row"> <div class="name"> Машина </div> <div class="price"> 1250 </div> </div> <div class="all-text"> </div> I would be grateful for the help.