Replace string using Jquery
In this article , I will show how
to replace string using jquery.
Source code
<%@
Page Language="C#" AutoEventWireup="true" CodeFile="replacestring.aspx.cs" Inherits="replacestring"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>Replace function
using Jquery</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"
type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function
() {
$(".replace
span,p").text(function (index,
text) {
return
text.replace('Code Solutions', 'Neeraj Srivastava');
});
});
</script>
</head>
<body>
<div class="replace">
<span>Code Solutions</span>
<p>Hello Friends I
am neeraj srivastava from Lucknow,India</p>
</div>
</body>
</html>
Out-Put:-
Replace string using Jquery
Reviewed by NEERAJ SRIVASTAVA
on
7:57:00 PM
Rating:
No comments: