jQuery replaceAll() Method Last Updated : 11 Jul, 2025 Suggest changes Share Like Article Like Report The replaceAll() method is an inbuilt method in jQuery that is used to replace selected elements with new HTML elements. Syntax: $(content).replaceAll(selector)Parameters: This method accepts two parameters as mentioned above and described below: content: It is the required parameter that is used to specify the content to insert.selector: It is a required parameter that specifies the elements to be replaced.Return Value: This method returns the selected elements with new content. The below program illustrates the above function: Example: html <!DOCTYPE html> <html> <head> <title>The replaceAll Method</title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <!-- jQuery code to show the working of this method --> <script> $(document).ready(function () { $("button").click(function () { $("<h1>GeeksforGeeks!</h1>").replaceAll("p"); $("h1").css({ "color": "green" }); }); }); </script> <style> div { width: 60%; height: 150px; padding: 10px; border: 2px solid green; font-size: 20px; text-align: center; } p { font-size: 25px; font-weight: bold; } </style> </head> <body> <div> <p>Welcome to </p> <!-- click on this button and see the change --> <button>Click Here!</button> <br> </div> </body> </html> Output: K kundankumarjha Follow Article Tags : Web Technologies JQuery jQuery-Methods Explore jQuery Tutorial 7 min read Getting Started with jQuery 4 min read jQuery Introduction 7 min read jQuery Syntax 2 min read jQuery CDN 4 min read jQuery SelectorsJQuery Selectors 5 min read jQuery * Selector 1 min read jQuery #id Selector 1 min read jQuery .class Selector 1 min read jQuery EventsjQuery Events 4 min read jQuery bind() Method 2 min read jQuery blur() Method 1 min read jQuery change() Method 2 min read jQuery EffectsjQuery animate() Method 2 min read jQuery clearQueue() Method 2 min read jQuery delay() Method 2 min read jQuery HTML/CSSjQuery addClass() Method 2 min read jQuery after() Method 1 min read jQuery append() Method 2 min read jQuery TraversingjQuery | Traversing 4 min read jQuery add() method 1 min read jQuery addBack() Method 2 min read My Profile ${profileImgHtml} My Profile Edit Profile My Courses Join Community Transactions Logout Like