Replace several tags from a text js
Posted
by Blanca
on Stack Overflow
See other posts from Stack Overflow
or by Blanca
Published on 2010-06-10T08:15:30Z
Indexed on
2010/06/10
8:22 UTC
Read the original article
Hit count: 249
Hi!
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
© Stack Overflow or respective owner