In addition to creating and inserting content, the ability to alter the current content of a page is a key scenario in Web development. jQuery has functions tailored to specific situations where content needs to be altered:
wrap()
: wrap the matched elements with the specified contentwrapAll()
: wrap content around the matched elements as a groupunWrap()
: remove the parents from the matched elementsempty()
: remove all the child elements from the matched elementsremove()
: removes elements from the page, including any embedded data and event handlersdetach()
: removes elements from the page, but maintains embedded data and event handlersreplaceAll()
: replaces the matched elements with the specified contentreplaceWith()
: replaces matched elements with content or the results of a callback function
This is paragraph 1
This is paragraph 2
This is paragraph 3
This is paragraph 4
This is paragraph 5