by: Saravanan Arumugam
Page views:
2065


Here's the simple jQuery script that used to replace string with another. Replace() method searches

specified string value and it will return specified replace value.


<head>

<meta charset="utf-8">

<title>Hello User!</title>

<script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>

<script type="text/javascript">

$(document).ready(function () {

$(".element span,p").text(function (index, text) {

return text.replace('Hello world', 'dotnetfox');

});

});

</script>

</head>

<body>

<div class="element">

<span>Hello world</span>

<p>Hello world</p>

</div>

</body>

</html>


Please subscribe, if you want to get email updates (it's free).



Comments
comments powered by Disqus
Subscribe via Email
    
message to display in fancybox