English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery replaceAll() Method

jQuery HTML/CSS Methods

The replaceAll() method replaces the selected elements with new HTML elements.

The replaceAll() method is similar toreplaceWith()butcontent And selectorInversely.

Syntax:

$(content).replaceAll(selector)

Example

Replace all paragraphs with <h1>Element:

$("button").click(function(){
  $("<h1>New Title</h1>").replaceAll("p");
});
Test and see‹/›

Parameter Value

ParameterDescription
contentSpecify the content to be inserted (must contain HTML tags)
selectorSpecify the element to be replaced

jQuery HTML/CSS Methods