<!DOCTYPE html>
<html>
<body>
<div id="div1">
<div id="div2">
<div id="data">data</div>
</div>
<div id="div3">a-</div>
</div>
<script type='text/javascript'>
var data = document.getElementById("data");
var elem = document.getElementById("div2");
while (elem.firstChild) {
elem.removeChild(elem.firstChild);
}
document.getElementById("div3").appendChild(data);
</script>
</body>
</html>