var photo = document.getElementById("photo"); photo.id = "newId"; document.getElementById("someOtherDiv").appendChild(photo);