Replace text in a string with jQuery

    [javascript]
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>Hello User!</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
    $(".element span").text(function(index, text) {
    return text.replace(‘British Pound’, ‘GBP’);
    });
    });
    </script>
    </head>
    <body>
    <div class="element">
    <span>1 British Pound</span>
    </div>
    </body>
    </html>
    [/javascript]

    Leave a Reply