// add without creating a new element document.getElementById('my_id') .insertAdjacentHTML('beforebegin', 'your_html_code');