I have been using appendChild to attach items to a div.
The default behaviour is to attach items to the bottom of the container div, but I want items to be appended to the top.
How can I do this?
I have been using appendChild to attach items to a div.
The default behaviour is to attach items to the bottom of the container div, but I want items to be appended to the top.
How can I do this?
try using insert before
parentDiv.insertBefore(newDiv, parentDiv.firstChild);
I've already figured it out. instead of putting AppendChild, I changed it to PrependChild. and it works good.
javascript: You have to insert in not append it :).
c# (asp.net): div.innerHTML = custom_html + div.innerHTML
link: Can I dynamically add HTML within a div tag from C# on load event?