I have a div named mainDiv and in that I have one input and one button html controls. Below is the code for that. (HTML FILE)
<div id="mainDiv">
<input type="text" id="myText">
<button type="button" id="myButton" onclick="myButtonClicked()">Click Me</button>
</div>
But I want to create such 10 divs at runtime with differenct IDs like mainDiv1, mainDiv2.....mainDiv10. Similarly myText1, myText2... (PHP FILE)
<?php
for(var i=1;i<=10;i++)
{
?>
<div id="mainDiv">
<input type="text" id="myText">
<button type="button" id="myButton" onclick="myButtonClicked()">Click Me</button>
</div>
<?php
}
?>
#mainDiv). This will place that ID multiple times, which isnt allowed, an ID may only occur once.