What is the before() method in jQuery?
In jQuery, the before() method is used to insert content before the selected elements in the jQuery collection.
Syntax
(a).before(b)
In the command above:
ais the element to which the new element would be added before.bis the content to be added.
Code
In the code below, the text Educative is good for learning! gets added before the h3 tag, which happens to be Sign up today.
This happens once the Add button is clicked.