Answers for "javascript add div before element"

2

javascript add div before element

var my_elem = document.getElementById('my_id');

var span = document.createElement('span');
    span.innerHTML = '*';
    span.className = 'asterisk';

my_elem.parentNode.insertBefore(span, my_elem);
Posted by: Guest on September-21-2020

Code answers related to "javascript add div before element"

Code answers related to "Javascript"

Browse Popular Code Answers by Language