Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery replaceAll() method

jQuery replaceAll() method

jQuery HTML/CSS methods jQuery HTML/CSS methods

Example

Replace the last

element with element:

$

(

"

button

"

)

.

click

(

function

(

)

{

$

(

"

Hello world!

"

)

.

replaceAll

(

"

p:last

"

)

;

}

)

;

Try it »


Definition and Usage

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


Syntax

$(

content

).replaceAll(

selector

)

Parameters Description
content Required. Specifies the content to insert (must contain HTML tags).
selector Required. Specifies which element is to be replaced.

jQuery HTML/CSS methods jQuery HTML/CSS methods