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="">
 <button class="move">Move</button>

the <div>
 <p class="img"><img src="">
 <button class="move">Move</button>

<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) { = 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');


 setTimeout(function() {
 }, 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:

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 JavaScriptjQueryHTML