As created objects to run serially in a loop?

Hello everybody !

Did not get to perform such a task

For example on the website there is no specific names and tags, as they are derived from the object alternately in a span tag?

Here's an example:

the <div>
 <p class="img"><img src="https://picsum.photos/30">
 <button class="move">Move</button>
</p>
</div>

the <div>
 <p class="img"><img src="https://lorempixel.com/30/30/technics">
 <button class="move">Move</button>
</p>
</div>

<div class="icon-right"><i class="fa fa-tags" aria-hidden="true"></i></div>

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

const icon = $('.icon-right');
const modal = $('.modal');

let Item = function(name) {
 this.name = name;
nameItem(this.name);
}

nameItem function(name) {
 $('.move').click(function() {
 let imgCat = $(this).parent().find('img').attr('src');

 let modalCat = ";

 for (let i in name) {
 modalCat += '<div class="modal-item">'
 modalCat += '<img src="' + imgCat + '">'
 modalCat += '<span class="name-item">' + name[i] + '</span>'
 modalCat += '<span class="remove-item"><i class="fa fa-times" aria-hidden="true"></i></span>'
 modalCat += '</div>';
}

 if ($('.move').is(this)) {
 if (!modal.children().is('.modal-item')) modal.text('Catalog');
 } else {
 modal.removeClass('show-item').text('nothing Here');
}

modal.addClass('modal-open').append(modalCat);

 setTimeout(function() {
$('.modal-item').addClass('show-item');
 }, 80);
})
}

let nameOneItem = new Item('Name one');
let nameTwoItem = new Item('Name two');

Tried it through the constructor and to substitute new values, but I get this effect:

https://codepen.io/zackary.Flatley95/pen/eajaQo

My task is to substitute in span tags with unique names - 'Name one', then when you press the button "Move" - 'Name two'
March 23rd 20 at 18:54
0 answer

Find more questions by tags HTMLjQueryJavaScript