Skip to content
Related Articles

Related Articles

jQuery | replaceAll() with Examples

Improve Article
Save Article
  • Last Updated : 13 Feb, 2019
Improve Article
Save Article

The replaceAll() method is an inbuilt method in jQuery which is used to replace selected elements with new HTML elements.



Parameters: This method accepts two parameter as mentioned above and described below:

  • content: It is the required parameter which is used to specify the content to insert.
  • selector: It is required parameter which specify the elements to be replaced.

Return Value: This method return the selected elements with new content.

Below program illustrates the above function:


<!DOCTYPE html>
        <title>The replaceAll Method</title>
        <script src=
        <!-- jQuery code to show the working of this method -->
            $(document).ready(function() {
                $("button").click(function() {
            div {
                width: 60%;
                height: 150px;
                padding: 10px;
                border: 2px solid green;
                font-size: 20px;
            p {
            <p>Welcome to </p>
            <!-- click on this button and see the change -->
            <button>Click Here!</button>

replaceall method

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!