How to set the div id dynamically? Here is my code:
<div id="q1"></div>
<div id="q2"></div>
<div id="q3"></div>
<div id="q4"></div>
<div id="q5"></div>
Now I want to set the q4 div id to q1 something like that in JavaScript. How can I do that in JavaScript or jQuery?
I have tried this.
document.getElementById("q4").id = "q1";
document.getElementById("q2").id = "q5";
but it is saying that the object is null or undefined.
Thanks. chakri.