jquery replaces the original html content

1. replaceWith()
Replace the selected content with the content enclosed in brackets.
$("#div").replaceWith("<div id="div2">div2</div>");
The method of use is as above, replace the element with the ID of div with the DIV element with the ID of div2.
   
2. replaceAll()
Replace the selected content with the selector inside the brackets.
$("<div>replaced content</div>").replaceAll("p");
As above, replace all p tags with selected DIV tags.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_USEnglish