jQuery prepend, append, before, after
They allow to add html to specific areas.
prepend()
Imagine that we have something like this list:
Item 1
Item 2
Item 3
Item 4
If we need to add a new list item ‘Item 0′ at the beginning, we can do it by using prepend()
|
|
append()
Append works the same way, but adds to the end of the list
|
|
before()
Image that you want to add a item to the list, before the the last item:
|
|
after()
Image that you want to add a item to the list, before the the last item:
|
|