Example 1 — Official Demo: Replace All Paragraphs
Swap every <p> for a bold “Paragraph.” element.
// <p>Hello</p><p>cruel</p><p>World</p>
$("<b>Paragraph.</b>").replaceAll("p"); How It Works
- Build content. A new
<b>is created. - Match targets. Every
pis selected for replacement. - Swap. Each paragraph is removed; a bold node takes its place.

