Javascript provides method insertBefore()  which we can use to insert html elements to DOM. This is quite effective and best ways when it comes to appending element. This method is called on element and parameters such as element which is to be appended and a reference element must be passed as parameter. Its syntax is given below.

#javascript #web development #web development

Javascript Insert Before and After HTML Element or Node with Snippet
2.10 GEEK