Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #add #div #element
ADD COMMENT
Topic
Name
2+9 =