How to use HTML replaceAll Method in JQuery
This article describe about HTML ReplaceAll Method in JQuery.
HTML replaceAll() method in jQuery
The replaceAll() method replaces all selected elements with the matched elements.
Syntax
$(content).replaceAll(selector)
|
Example
Following is a simple example a showing the usage of this method.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function ()
{
$("button").click(function ()
{
$("<b>Hello world!</b>").replaceAll("p");
});
});
</script>
</head>
<body>
<p>This is a JQuery.</p>
<p>This is .Netheaven.</p>
<button>Replace each p element after click this button</button>
</body>
</html>
|
Output1
Output2
You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here