Home
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script> $(document).ready(function () { $("button").click(function () { $("<h2>This is a h2 tag</h3>").replaceAll('div'); $("<h3>This is a h3 tag</h3>").replaceAll('.myCls'); }); }); </script> </head> <body> <h1>jQuery Manipulation Methods: replaceAll()</h1> <div>This is a div tag</div> <span class="myCls">This is a span tag</span><br/> <button>Click Me to test replaceAll()</button> </body> </html>
Result: