Replace string using jQuery

3 Comments | 2296 Views | Post by: Admin | Tags: Replace string using jQuery, Replace string, Replace string using jQuery tutorial


In this tutorial we are going to learn to replace string using jquery


In this tutorial we are going to learn to replace string using jquery so for this simple create a HTML page with the following codes.

<!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>
    <title></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', 'SourceCodehub');
            });
        });

    </script>
</head>
<body>
    <div class="element">
        <span>Hello</span>
        <p>
            Hello</p>
    </div>
</body>
</html>

so In this tutorial we have learn to replace string using jquery. Happy Coding!!!!


Post Comments

if you have some suggestion, question, request on Replace string using jQuery.

Please use the comment box to express your views.

 

Comments:

loading...