jQuery | appendTo() with Examples
The appendTo() is an inbuilt method in jQuery that is used to insert HTML element at the end of the selected element. Syntax:
Here the element content specifies the content to be inserted.
Parameters: It accepts a parameters “selector” which specifies the elements to which content will be appended.
Return Value: It returns the modified selected element.
jQuery code to show the working of this method:
Code #1: In the below code, id content with element “span” will be append to id “#hel” element.
Code #2: In the below code, we are directly appending a “p” element using this method.
Time Complexity: O(1)
Auxiliary Space: O(1)