Click to See Complete Forum and Search --> : Changing ID of a div


Dudsmack
01-17-2004, 01:30 PM
I have a div, say "myDiv". Naturally I refer to it as document.getElementByID('myDiv').x; Is it possible to rename the Div, to say "newName" so that it could be refered to by document.getElementByID('newName').x;

I know I could do a swap. Div1 => Div2, delete Div1 -- but I'd rather just change this one value if possible.

Thnx in advance.

fredmv
01-17-2004, 02:00 PM
document.getElementById('myDiv').setAttribute('id', 'newName');