In jQuery, the
prepend() method is used to insert content at the beginning of the selected elements in the jQuery collection.
a: the element to which the new element will be prepended.
b: the content to be prepended.
In the code below, the text
Educative rocks! gets added before the
p element of the page, which is
Learn about Prepend in Jquery. In our case, the text is added once the
Prepend Text button is clicked.
View all Courses