What is the opposite of append in jquery?

I use $('.posts').append('test') to add 'test' as the last element in the posts div . How can I make it the first element?

+4
source share
2 answers

Use with .prepend() as

 $('.posts').prepend('test'); 

Try LINK

+11
source

You are using prepend()

 ('.posts').prepend('test'); 
+4
source

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


All Articles