jQuery .replaceAll() Method

Last Updated Jul 21, 2015, 12:00:06 PM





jQuery .replaceAll() Method

jQuery replaceAll() method will replace all HTML elements in the DOM tree with new HTML elements

Syntax

The jquery .replaceAll() method is similar to .replaceWith(), but with the source and target is reversed.

Example

jQuery

The above jQuery replaceAll() method will replace all the existing paragaphs and its text with new h1 text supplied in the jquery code

Output

The above jquery replaceAll() method example will produce the following output


jQuery replaceAll() method
Try It Now

jQuery DOM Reference

Other Advanced jQuery and DOM topics you might want to learn
jQuery Basic DOM Methods

jQuery DOM Removal

jQuery DOM Insertion Inside

jQuery DOM Insertion Outside

jQuery DOM Insertion Around

Sources and Credits

The content and methods in the tutorial has been referred and updated with jQuery API and The jQuery Foundation

Last Updated Jul 21, 2015, 12:00:06 PM