How to add an html element as the first element in an existing body using jQuery?

I used $('body').append('MY HTML elements') , but this code adds these elements to the end of the body, I want to add as the first element inside the body.

How to do it using jQuery?

+4
source share
1 answer

You use the prepend function:

 $('body').prepend('My HTML elements'); 
+6
source

Source: https://habr.com/ru/post/1286745/


All Articles