Say I am duplicating this block of html:
<div class="style1" id="a"> <div class="style2"><div class="style3" id="b"></div></div> </div>
and my javascript code is:
newNode = document.getElementById('a').cloneNode(true);
That all works fine so I end up with two copies of the above html both have the same id's, now not only is it incorrect html to have two id's the same it is also a requirement for what i am doing that the id's need to be different as i want to refer to them seperately.
So I am able to modify the node with id 'a' easily enough by doing:
newNode.setAttribute('id', 'c');
But how do I modify the node with id 'b' without changing both instances of node 'b' to the new id. I tried doing this but got an error and no result:
newNode.firstChild.firstChild.setAttribute('id', 'd');
Any ideas?
Edited by BlazeForc3, 06 September 2007 - 12:24 AM.
