K
K
Kusmich2015-10-28 01:15:30
css
Kusmich, 2015-10-28 01:15:30

How to increase the id value of an element after each iteration that is dynamically created?

Tags are created dynamically. And how can I make the id value of the next created tag increase by 1 after each iteration?

tried like this:

var calk = 0;

//добавил в цыкл calk ++;
//добавил div.append('<img class="tableBanner" id="tableBanner + calk "   src="">')


But it doesn't work that way, the value from the variable is not passed to the tag. How to do it right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2015-10-28
@Kusmich

cycle

div.append('<img class="tableBanner" id="tableBanner"+ calk +"  src="">')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question