问题描述:

This question already has an answer here:

  • How to set DOM element as the first child?

    5 answers

网友答案:
list.insertBefore(entry, list.firstChild);

See https://developer.mozilla.org/en-US/docs/Web/API/Node.insertBefore

网友答案:

.appendChild() will add the element to the last, if you want to prepend any element, you can use .insertBefore()

Incase jQuery, then .prepend()

相关阅读:
Top