jQuery replaceAll Method
jQuery replaceAll Method : is used to replace the selected element with another element. It replaces in all matching selector element with the given content.
We are going to explain this method with example and demo.
jQuery replaceAll Method Syntax
Syntax for replaceAll method –
$(content).replaceAll(selector);
jQuery replaceAll Method Example
Here is an example of replaceAll method Click on Try it button to see the output-
jQuery replaceAll() Method – Example
<script type="text/javascript"> $(document).ready(function(){ $( "#replaceExample" ).on( "click", function(event) { $("<div style='background:skyblue;padding:10px;'>Hi I Am New One.....</div>").replaceAll(".replaceAll"); }); }); </script> |
When you run above example it will produce the following output –
Advertisements