<body> </body> <script> var elem = document.createElement('p'); elem.textContent = 'textContent'; document.body.appendChild(elem); setTimeout(function() { alert('1'); },100); </script>