The forums ran from 2008-2020 and are now closed and viewable here as an archive.
If you use insertBefore to move a DIV in your markup, is it then possible to have it return to its original position without specifying the position using the same method?
Not AFAIK. You’d need to “remember” where it used to belong (assign the former previousSibling to a variable).
No previous sibling, but how do you assign the previous element to a variable? Can’t find the correct way/code from googling…
read about previousSibling / nextSibling.
If it has neither (i.e., is an only child), you can use the parentElement.
No parent DIV. Well, BODY would be the parent DIV, but if your idea is going to work I need to identify the previous element before the one I’m moving.