Jquery selector on Django loop
So I have this
I need to select the items name when the user clicks on the anadir_button.
Something like
$('.producto_precio').last()clone().appendTo('#list_pedidos');
But this one just selects almendras, bananas and bolson frutal
- {% for producto in reparto_martes %}
- <div class="col-md-3">
- <div class="card mb-4 box-shadow product-box">
- <img class="card-img-top product-photo" data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" alt="Thumbnail [100%x225]" style="height: 225px; width: 100%; display: block;" src={{ producto.foto }} data-holder-rendered="true">
- <div class="card-body">
- <h4 class="card-text producto_precio">${{ producto.precio }}</h4>
- <h5 class="card-text producto_nombre">{{ producto.nombre }}</h5>
- <div class="d-flex justify-content-between align-items-center">
- <button type="button" class="btn btn-success anadir_button">Añadir</button>
- <small class="text-muted"></small>
- </div>
- </div>
- </div>
- </div>
- {% endfor %}