insert/remove HTML content between div tags

dom, javascript

Solution

If you're replacing the contents of the div and have the HTML as a string you can use the following:

document.getElementById('mydiv').innerHTML = '<span class="prego">Something</span>';

Problem

how can I insert some HTML code between `<div id="mydiv">...</div>` using javascript? Ex: `<div id="mydiv"><span class="prego">Something</span></div>` its about 10 lines of html of most. thank you

Original source