.replace(/regex/,’content’)
by Sue
Gaah. So I keep needing this because some bad CMS has outputted some crap css and I need to change it.
$('span.selector').each(function(){ $(this).html( $(this).html().replace(/\,/gi,'<br>') ); });
In this case I’m replacing commas with break tags.
Comments
in jQuery 1.4 you can reduce that down to this..
$(‘span.selector’).html(function(i,html){
return html.replace(/\,/gi,”);
});