开发者

Find apostrophe's and replace with some other character

I am stuck with a problem, which has got to do with Apostrophe's. How do i find and replace all apostrophe's with some other character. The code is as follows.

Script

jQuery('.note').each(function() {

        var final = jQuery(this).text();
        jQuery(this).html('<div class="solutionnotes">'+final+'</div>');

         var htmlElement = jQuery('.solutionnotes').text();
         var e = htmlElement;
         alert(e);
         e.replace(/\&amp;apos;/g, "acute;");
    });

HTML Code

<body>
<div class="note">&amp;apos; &amp;apos; &amp;apos; Test 1 &amp;apos; &amp;ap开发者_JAVA技巧os;</div>
<div class="note">&amp;apos; &amp;apos; &amp;apos; Test 1 &amp;apos; &amp;apos;</div>
<div class="note">&amp;apos; &amp;apos; &amp;apos; Test 1 &amp;apos; &amp;apos;</div>
</body>


Try this:

jQuery('.note').each(function() {
        var final = jQuery(this).text();
        jQuery(this).html('<div class="solutionnotes">'+final+'</div>');

         var htmlElement = jQuery('.solutionnotes').text();
         var e = htmlElement.replace(/&amp;apos;/g, "HELLO");
         alert(e);
    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜