Description htmlappendprependafterbeforeremoveempty
Description html() method is used to change selected elements and attributes. It also brings the HTML contents (innerHTML) of the initially matched element. Below is the syntax for html method.
Syntax:
Example
Description append() method is used to insert the data at the end or as the last child of the matched element in the jQuery collection.
The append() and appendTo() methods are similar.
Syntax:
Example
Description prepend() method is used to insert the content at the starting or as the first child of the matched element. It is opposite of the jQuery append() method.
To insert the data at the end of the elements,use the append method.
Syntax:
Example
Description after() method is used to insert the content after matched element.This is similar to jQuery append() method.
To insert content before the selected element, use jQuery before() method.
Syntax:
Example
Description before() method is used to insert the content before matched element. It adds the content specified by the parameter, before each element in the set of matched elements.
Syntax:
Example
Description remove() method removes the selected HTML element from the DOM. It removes the selected element itself, as well as everything inside it (including all texts and child nodes). This method also removes the data and the events of the selected elements.
Syntax:
Example
Description empty() method. This method doesn't remove the element itself. To remove the element without removing data and events, use the method detach().
Syntax:
Example
Key Points