Hi
I'm trying to play around with insertBefore() but I don't understand how to enhance my code below in order to have the div moved either above or underneath. The only thing that I'm able to do is move the div at the very bottom
Changing el[0] to el[1] or el[-1] doesn't change anything
Thanks for the help!
I'm trying to play around with insertBefore() but I don't understand how to enhance my code below in order to have the div moved either above or underneath. The only thing that I'm able to do is move the div at the very bottom
Changing el[0] to el[1] or el[-1] doesn't change anything
Code:
function elem_move ( this_id ) {
var el = document.getElementById( this_id );
el.parentNode.insertBefore( el, el[0] );
}
Thanks for the help!