I have a text I want to append multiple divs but the id should be changed dynamically. e.g:
<div id=first>text</div>
<div id=first0>text</div>
<div id=first1>text</div>
<div id=first2>text</div>
<div id=first3>text</div>
<div id=first4>text</div>
<div id=first5>text</div>
Any help? thanks..
You can change it with .attr():
Your title and question content seem to disagree with each other. I am assuming you are wanting to create div's where each id sequentially increments each time one is created?
try to change the code to :
dont forget the
id
inside " " (id="first"
notid=first
)now you can simply use jquery :
$("#first").attr('id','first6');
If you were interested in how styling works.`