开发者

Replace several tags from a text js

开发者 https://www.devze.com 2023-01-02 19:07 出处:网络
I have this pice of text I would like to change: [¿Cómo se procede cuando la mujer o pareja de un < b>fallecido< /b> pide

I have this pice of text I would like to change:

[¿Cómo se procede cuando la mujer o pareja de un < b>fallecido< /b> pide la congelación del semen]

So I would like to remove ], [ and < b>< /b>

Is there any way to change it everything in the same time??

I tried:

function replaceThings(){
    jQuery(".summary").each(function(){
        var t = jQuery(this).text();
        jQuery(this).text(t.replace(/& lt;/g, ''));
        jQuery(this).text(t.replace('[', ''))开发者_运维技巧;
        jQuery(this).text(t.replace(']', ''));
    });

But only replaces ].

Thanks in advance


function replaceThings(){
    jQuery(".summary").each(function(){
        var t = jQuery(this).text();
        t = t.replace(/& lt;/g, ''));
        t = t.replace('[', ''));
        t = t.replace(']', ''); 
        jQuery(this).text(t);
    });
0

精彩评论

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

关注公众号