0
On clicking add button , div is duplicated .How to edit code so that each added div element has unique id.eg: 3rd add btn id b13
3 ответов
+ 1
Add a variable, increase it each time you click add button and add it's value to the new div id. Add to body "<div id=\"div"+i+"...
0
how ?
can you explain the code ?
0
Something like this. I added a bit to your code. Each time you click the button new divs will have ID's div1, div2, div3, etc.
https://code.sololearn.com/W589x2YJxkuI/?ref=app