ExampleReplace each p element with some bold text:
Try it yourself » |
The replaceAll() method replaces selected elements with new content.
Tip: The replaceWith() and replaceAll() methods does the same thing. The difference is in the syntax: the placement of the content and selector, and that replaceWith() can replace content using a function.
$(content).replaceAll(selector) |
Parameter | Description |
---|---|
content | Required. Specifies the new content. Possible values:
|
selector | Required. Specifies which elements to be replaced |
![]() |
Try it Yourself - Examples |
Replace elements with a new element
How to create a new DOM element, with document.createElement(), to replace the selected elements.