var div = document.createElement('div'); div.innerHTML ="<div><span>text</span><script>alert(\'qq\')</script></div>" document.getElementById('id_10').appendChild(div);